Tabs
BsTabs is a component used for creating a pseudo-navigation for a page.
Overview
Tabs navigation can be created using <bs-tabs> and <bs-tab>. <bs-tabs> is used to create the navigation container and <bs-tab> is used to create the tab-items and their contents.
INFO
- See BsIcon to learn more about how to apply Google Material Symbols to the
iconproperty. - Since Vue MDBootstrap v2.1.0, Google Material Icons are replaced with Google Material Symbols.
Style Variants
Bootstrap Tabs
Bootstrap Tabs style is default style variant when the variant property is not defined. To explicitly define this style variant, sets variant property value of <bs-tabs> to 'tabs'. When use inside <bs-card> component, sets the value of inner-class property to 'md-card-header' to have an appropriate Bootstrap Tabs style.
Bootstrap Pill
Bootstrap Pill style is another style variant from Bootstrap. To use it, sets variant property value of <bs-tabs> to 'pills'. When use inside <bs-card> component, sets the inner-class property value to 'md-card-header' to have an appropriate Bootstrap Pill style.
Additionally, use the active-class property on <bs-tabs> to customize the active Tab color, for example active-class="bg-unique active". And use the tab-class property to customize the inactive Tab color.
Material
Material style variant can be enabled, by setting variant property value of <bs-tabs> to 'material' and use the color property to have an appropriate tabs color.
Additionally, use the active-class property to customize the active Tab color and indicator, for example: active-class="border-yellow active".
TIP
Any valid color variants can be applied to the color property.
Modern
Modern style variant can be enabled, by setting variant property value of <bs-tabs> to 'modern' and use the color property to have an appropriate tabs color.
Additionally, use the active-class property to customize the active Tab color, for example: active-class="bg-unique active". And use the tab-class property to customize the inactive Tab color.
TIP
Any valid color variants can be applied to the color property.
Tabs Placement
The Tabs can be placed at top, bottom, left or right side.
Top
This placement is the default tabs position when tab-position property is not defined. To explicitly define Tabs placement, sets tab-position property value of <bs-tabs> to 'top'. Additionally, you can also set the tabs alignment by setting the alignment property value.
Bottom
To place the tabs at bottom side, sets tab-position property value of <bs-tabs> to 'bottom'. Additionally, you can also set the tabs alignment by setting the alignment property value.
Left
To place the tabs at left side, sets tab-position property value of <bs-tabs> to 'left'. Additionally, you can also set the tabs alignment by setting the alignment property value.
Right
To place the tabs at left side, sets tab-position property value of <bs-tabs> to 'right'. Additionally, you can also set the tabs alignment by setting the alignment property value.
Icons
Position And Size
To change the icon position use icon-position property and use icon-size to change the icon size. If you set this property, each tab item will have the same icon position and size.
Additionally, you can sets icon-variant property to outlined (default), rounded, sharp, filled, outlined_filled, rounded_filled, or sharp_filled to set the icon style variant. See Google Material Symbols for details.
Icon Only
Do not set the label property of <bs-tab> and set the value of icon property to the desired icon name to display only the icon.
Using Extra Slot
Use the append-header slot to add additional components to the top right side of the tab.
CSS Variables
As CSS technology evolves, Vue MDBootstrap introduces local CSS variables on .md-tabs for better customization.
.md-tabs {
--md-tab-content-background: inherit;
--md-tab-content-padding: #{vars.$padding-md + 0.25};
--md-tab-placement-top-shadow: #{vars.$tabs-placement-top-shadow};
--md-tab-placement-bottom-shadow: #{vars.$tabs-placement-bottom-shadow};
--md-tab-placement-left-shadow: #{vars.$tabs-placement-left-shadow};
--md-tab-placement-right-shadow: #{vars.$tabs-placement-right-shadow};
--md-tab-spacing: #{vars.$tabs-spacing};
// Material and Modern style variant
--md-tab-item-padding: #{vars.$tabs-item-padding};
--md-tab-item-color: #{color.change(colors.$white, $alpha: 0.6)};
--md-tab-item-active-color: #{colors.$white};
--md-tab-item-hover-color: #{color.change(colors.$white, $alpha: 0.8)};
--md-tab-item-disabled-color: #{color.change(colors.$white, $alpha: 0.3)};
--md-tab-item-font-weight: var(--font-weight-medium);
--md-tab-item-font-size: 0.95rem;
// Bootstrap Tabs style variant
--md-tab-tabs-background: var(--md-card-cap-bg, #{vars.$card-cap-bg});
--md-tab-tabs-border-radius: var(--md-radius, #{vars.$radius-md});
--md-tab-tabs-border-color: var(--md-card-border-color, #{vars.$card-border-color});
--md-tab-tabs-border-width: var(--md-card-border-width, thin);
--md-tab-tabs-active-bg: #{colors.$white};
--md-tab-tabs-active-border-color: #{colors.$gray-300};
--md-tab-tabs-hover-border-color: oklch(0.92 0 0);
--md-tab-tabs-color: #{helper.to-oklch(color.mix(colors.$mdb-default-color, color.change(colors.$gray-800, $alpha: 0.8), 30%, oklch))};
--md-tab-tabs-hover-color: var(--md-field-active-indicator);
--md-tab-tabs-margin-x: var(--md-card-cap-padding-x, #{vars.$card-cap-padding-x});
--md-tab-tabs-margin-y: var(--md-card-cap-padding-y, #{vars.$card-cap-padding-y});
// Bootstrap Pill style variant
--md-tab-pills-background: var(--md-card-cap-bg, #{vars.$card-cap-bg});
--md-tab-pills-border-radius: var(--md-radius, #{vars.$radius-md});
--md-tab-pills-border-color: var(--md-card-border-color, #{vars.$card-border-color});
--md-tab-pills-border-width: var(--md-card-border-width, thin);
--md-tab-pills-color: #{helper.to-oklch(color.mix(colors.$mdb-default-color, color.change(colors.$gray-800, $alpha: 0.8), 30%, oklch))};
--md-tab-pills-active-bg: var(--md-field-active-indicator);
--md-tab-pills-active-color: #{colors.$white};
--md-tab-pills-hover-color: var(--md-field-active-indicator);
--md-tab-pills-margin: #{vars.$tabs-pills-margin};
// Material style variant
--md-tab-material-margin-start: #{vars.$padding-md};
--md-tab-material-margin-end: #{vars.$padding-md};
--md-tab-material-padding: #{vars.$tabs-material-padding};
--md-tab-material-indicator-active-color: #{colors.$white};
--md-tab-material-indicator-border: #{vars.$tabs-material-indicator-border};
// Modern style variant
--md-tab-modern-border-radius: var(--md-radius-pill);
--md-tab-modern-active-bg: #{color.change(colors.$black, $alpha: 0.2)};
--md-tab-modern-margin-horizontal: #{vars.$tabs-modern-margin-horizontal};
--md-tab-modern-margin-vertical: #{vars.$tabs-modern-margin-vertical};
}API Reference
BsTabs
| Property | Type | Default | Description |
|---|---|---|---|
| active-class | String | 'active' | Optional css class name for active Tab item. |
| alignment | String | 'left' | Tabs alignment. Valid values: left (deprecated), right (deprecated), start, end, center, justified. v2.0.0 |
| color | String | The tabs color style for tabs variant: modern and material. Any Color Variants can be used. | |
| content-class | String | Optional css class name for Tab content. | |
| content-transition | String | 'fade' | Tab content display animation transition. Valid values: fade, slide-fade, slide-fade-reverse, popover. |
| flex | Boolean | false | Create Tabs with flex styles. Only valid for tabs or pills variant. |
| icon-position | String | 'left' | Tab item's icon position. Valid values: left, right, top, bottom. |
| icon-size | Number | Tab item icon size. v2.0.0 | |
| inner-class | String | Optional css class name for tabs item's container. | |
| tab-class | String | Optional css class name for tab items. | |
| tab-position | String | 'top' | Tabs position. Valid values: left, right, top, bottom. |
| model-value v-model | Number | Monitored by v-model to maintain active tab index. v2.0.0 | |
| variant | String | 'tabs' | Tabs style variant. Built-in values are: tabs, pills, material, modern. Updated in v2.2.0 |
| Name | Arguments | Description |
|---|---|---|
| change | (newTab:ComponentInternalInstance, oldTab:ComponentInternalInstance, newIndex:Number, oldIndex:Number) | Fired when active tab is changed. |
| update:model-value | (value:Number) | Fired when this component's model-value is updated. v2.0.0 |
| Name | Description |
|---|---|
| default | The outlet slot used to place the tab item component. |
| append-header | The outlet slot used to place the additional component. v2.2.0 |
BsTab
| Property | Type | Default | Description |
|---|---|---|---|
| active-class | String | Optional css class name for active Tab item which is used to overrides the active-class property of <bs-tabs>. | |
| aria-label | String | Generate aria-labelledby attribute. | |
| disabled | Boolean | false | The Tab state, enabled or disabled. v2.0.0 |
| icon | String | The icon to display inside Tab item component. Updated in v2.1.0 Use any valid android icon name from Google Material Symbols with or without a suffix. Valid suffixes are: icon-variant property. | |
| icon-flip | String | Flip the icon, valid values are: horizontal, vertical, both. v2.0.0 | |
| icon-rotation | Number | Rotate the icon, valid values are: 90, 180, 270. v2.0.0 | |
| icon-pulse | Boolean | false | Apply pulse animation to the icon. v2.0.0 |
| icon-spin | Boolean | false | Apply spin animation to the icon. v2.0.0 |
| icon-variant | String | 'outlined' | Use predefined icon style variant. Valid values are: outlined, rounded, sharp, filled, outlined_filled, rounded_filled, and sharp_filled. v2.1.0 |
| id | String | The Tab ID attribute. This property value is auto generates. | |
| label | String | The Tab label. | |
| location | RouteLocationAsRelativeGeneric | The navigation location target. v2.0.11 The value must be an object that satisfies the to property of the <RouterLink> component.This is a shortcut to create a <RouterLink> inside the component. See vue-router for more information. | |
| path | String | The route path for the navigation target. This is a shortcut to create a <RouterLink> inside the component. See vue-router for more information. | |
| path-name | String | The path name for the navigation target. v2.0.11 This is a shortcut to create a <RouterLink> inside the component. See vue-router for more information. | |
| path | String | <router-link> property, the route path for the navigation target. See vue-router for more information. | |
| url | String | Absolute or relative URL for the navigation target, if doesn't use vue-router. |
| Name | Description |
|---|---|
| default | The outlet slot used to place the tab content. |
