Create a widget of tabbable panes of local content. The tabs component is built upon navs and cards internally, and provides full keyboard navigation control of the tabs.
For navigation based tabs (i.e. tabs that would change the URL), use the <b-nav> component instead.
<div><b-tabscontent-class="mt-3"><b-tabtitle="First"active><p>I'm the first tab</p></b-tab><b-tabtitle="Second"><p>I'm the second tab</p></b-tab><b-tabtitle="Disabled"disabled><p>I'm a disabled tab!</p></b-tab></b-tabs></div>
Quis magna Lorem anim amet ipsum do mollit sit cillum voluptate ex nulla tempor. Laborum
consequat non elit enim exercitation cillum aliqua consequat id aliqua. Esse ex
consectetur mollit voluptate est in duis laboris ad sit ipsum anim Lorem. Incididunt
veniam velit elit elit veniam Lorem aliqua quis ullamco deserunt sit enim elit aliqua
esse irure.
<div><b-cardno-body><b-tabscard><b-tabno-bodytitle="Picture 1"><b-card-imgbottomsrc="https://picsum.photos/600/200/?image=21"></b-card-img><b-card-footer>Picture 1 footer</b-card-footer></b-tab><b-tabno-bodytitle="Picture 2"><b-card-imgbottomsrc="https://picsum.photos/600/200/?image=25"></b-card-img><b-card-footer>Picture 2 footer</b-card-footer></b-tab><b-tabno-bodytitle="Picture 3"><b-card-imgbottomsrc="https://picsum.photos/600/200/?image=26"></b-card-img><b-card-footer>Picture 3 footer</b-card-footer></b-tab><b-tabtitle="Text"><b-card-title>This tab does not have the <code>no-body</code> prop set</b-card-title><b-card-text>
Quis magna Lorem anim amet ipsum do mollit sit cillum voluptate ex nulla tempor. Laborum
consequat non elit enim exercitation cillum aliqua consequat id aliqua. Esse ex
consectetur mollit voluptate est in duis laboris ad sit ipsum anim Lorem. Incididunt
veniam velit elit elit veniam Lorem aliqua quis ullamco deserunt sit enim elit aliqua
esse irure.
</b-card-text></b-tab></b-tabs></b-card></div>
<div><b-tabscontent-class="mt-3"fill><b-tabtitle="First"active><p>I'm the first tab</p></b-tab><b-tabtitle="Second"><p>I'm the second tab</p></b-tab><b-tabtitle="Very, very long title"><p>I'm the tab with the very, very long title</p></b-tab><b-tabtitle="Disabled"disabled><p>I'm a disabled tab!</p></b-tab></b-tabs></div>
<div><b-tabscontent-class="mt-3"justified><b-tabtitle="First"active><p>I'm the first tab</p></b-tab><b-tabtitle="Second"><p>I'm the second tab</p></b-tab><b-tabtitle="Very, very long title"><p>I'm the tab with the very, very long title</p></b-tab><b-tabtitle="Disabled"disabled><p>I'm a disabled tab!</p></b-tab></b-tabs></div>
<div><b-tabscontent-class="mt-3"align="center"><b-tabtitle="First"active><p>I'm the first tab</p></b-tab><b-tabtitle="Second"><p>I'm the second tab</p></b-tab><b-tabtitle="Disabled"disabled><p>I'm a disabled tab!</p></b-tab></b-tabs></div>
<div><b-tabsactive-nav-item-class="font-weight-bold text-uppercase text-danger"active-tab-class="font-weight-bold text-success"content-class="mt-3"
><b-tabtitle="First"active><p>I'm the first tab</p></b-tab><b-tabtitle="Second"><p>I'm the second tab</p></b-tab><b-tabtitle="Disabled"disabled><p>I'm a disabled tab!</p></b-tab></b-tabs></div>
<b-tabscontent-class="mt-3"><!-- This tabs content will always be mounted --><b-tabtitle="Regular tab"><b-alertshow>I'm always mounted</b-alert></b-tab><!-- This tabs content will not be mounted until the tab is shown --><!-- and will be un-mounted when hidden --><b-tabtitle="Lazy tab"lazy><b-alertshow>I'm lazy mounted!</b-alert></b-tab></b-tabs>
<template><div><!-- Tabs with card integration --><b-cardno-body><b-tabsv-model="tabIndex"smallcard><b-tabtitle="General">I'm the first fading tab</b-tab><b-tabtitle="Edit profile">
I'm the second tab
<b-card>I'm the card in tab</b-card></b-tab><b-tabtitle="Premium Plan"disabled>Sibzamini!</b-tab><b-tabtitle="Info">I'm the last tab</b-tab></b-tabs></b-card><!-- Control buttons--><divclass="text-center"><b-button-groupclass="mt-2"><b-button @click="tabIndex--">Previous</b-button><b-button @click="tabIndex++">Next</b-button></b-button-group><divclass="text-muted">Current Tab: {{ tabIndex }}</div></div></div></template><script>exportdefault {
data() {
return {
tabIndex: 1
}
}
}
</script>
There are no open tabs
Open a new tab using the + button above.
<template><div><b-cardno-body><b-tabscard><!-- Render Tabs, supply a unique `key` to each tab --><b-tabv-for="i in tabs":key="'dyn-tab-' + i":title="'Tab ' + i">
Tab contents {{ i }}
<b-buttonsize="sm"variant="danger"class="float-right" @click="closeTab(i)">
Close tab
</b-button></b-tab><!-- New Tab Button (Using tabs-end slot) --><templatev-slot:tabs-end><b-nav-item @click.prevent="newTab"href="#"><b>+</b></b-nav-item></template><!-- Render this if no tabs --><templatev-slot:empty><divclass="text-center text-muted">
There are no open tabs<br>
Open a new tab using the <b>+</b> button above.
</div></template></b-tabs></b-card></div></template><script>exportdefault {
data() {
return {
tabs: [],
tabCounter: 0
}
},
methods: {
closeTab(x) {
for (let i = 0; i < this.tabs.length; i++) {
if (this.tabs[i] === x) {
this.tabs.splice(i, 1)
}
}
},
newTab() {
this.tabs.push(this.tabCounter++)
}
}
}
</script>