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
- The
urlproperty in the example above is optional and can be ignored. - See BsIcon to learn more about how to apply the 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 inner-class property value to '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 '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 sets the label property of <bs-tab> and sets the icon property value to display only the icon.
CSS Variables
Added since v2.0.0--md-tabs-content-padding: 1.25rem;
--md-tabs-item-padding: 0.75rem 1.25rem;
--md-tabs-item-spacing: 0.375rem;
--md-tabs-item-font-weight: 500;
--md-tabs-placement-top-shadow: 0px 4px 5px rgba(0, 0, 0, 0.15),0px 2px 2px rgba(0, 0, 0, 0.14),0px 3px 1px -2px rgba(0, 0, 0, 0.12);
--md-tabs-placement-bottom-shadow: 0px -1px 5px rgba(0, 0, 0, 0.2),0px -1px 2px rgba(0, 0, 0, 0.14),0px -3px 1px -2px rgba(0, 0, 0, 0.12);
--md-tabs-placement-left-shadow: 1px 0px 5px rgba(0, 0, 0, 0.2),2px 0px 2px rgba(0, 0, 0, 0.14),3px 0px 1px -2px rgba(0, 0, 0, 0.12);
--md-tabs-placement-right-shadow: -1px 0px 5px rgba(0, 0, 0, 0.2),-2px 0px 2px rgba(0, 0, 0, 0.14),-3px 0px 1px -2px rgba(0, 0, 0, 0.12);
// Bootstrap Tabs style variant
--bs-nav-tabs-border-color: #dee2e6;
--bs-nav-tabs-border-radius: 0.375rem;
--bs-nav-tabs-border-width: 1px;
--bs-nav-tabs-link-active-color: #495057;
--bs-nav-tabs-link-active-bg: #fff;
--bs-nav-tabs-link-active-border-color: #dee2e6 #dee2e6 #fff;
--bs-nav-tabs-link-hover-border-color: #e9ecef #e9ecef #dee2e6;
--md-tabs-nav-active-border-color: #dee2e6;
--md-tabs-nav-margin-x: 1rem;
--md-tabs-nav-margin-y: 0.5rem;
// Bootstrap Pill style variant
--bs-nav-pills-border-radius: 0.375rem;
--bs-nav-pills-link-active-bg: rgb(var(--md-field-primary-indicator-rgb));
--bs-nav-pills-link-active-color: #fff;
// Bootstrap Tabs and Pill style variant
--bs-nav-link-color: rgba(69, 64, 98, 0.86);
--bs-nav-link-hover-color: rgb(var(--md-field-primary-indicator-rgb))
// Material style variant
--md-tabs-material-padding: 1.125rem 1.5rem 1rem 1.5rem;
--md-tabs-material-margin-start: 1rem;
--md-tabs-material-margin-end: 1rem;
--md-tabs-material-indicator-active-color: #fff;
--md-tabs-material-indicator-border: 0.2rem;
// Modern style variant
--md-tabs-modern-border-radius: 50rem;
--md-tabs-modern-padding: 0.625rem 1.25rem;
--md-tabs-modern-active-bgcolor: rgba(0, 0, 0, 0.2);
// Material and Modern style variant
--md-tabs-item-color: rgba(255, 255, 255, 0.6);
--md-tabs-item-active-color: #fff;
--md-tabs-item-hover-color: rgba(255, 255, 255, 0.8);
--md-tabs-item-disabled-color: rgba(255, 255, 255, 0.3);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. Valid values: tabs, pills, material, modern. |
| 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. |
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 on 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. |
