Tabs
The Tabs component is a responsive horizontal navigation bar that allows the user to easily switch between content. Tab panelsare a set of individual content sections, where only one content panel can be displayed at a time. Each tab panel has an associated tab element that, when activated, displays the panel. The list of tab elements is arranged along one edge of the currently displayed panel, the top edge. The component implements the W3C ARIA APG Tabs Pattern.
Examples
Base
Each item component can have a value
prop. The active tab is represented by the value of the item as the modelValue
prop of the tabs component.
Types
The tabs header can be displayed in different styles using the type
prop.
Position
The tabs header can be positioned by the position
prop.
Expanded
When the expanded
prop is set, the tabs header will be occupy the full with it can have.
Sizes
The component can be displayed in different sizes using the size
prop.
Vertical
Adding the vertical
prop displays the component vertically instead of horizontally.
Custom header
The individual tab label can be customised using the header
slot.
Long header
The multiple
prop allows to break the tab header to be broken into multiple lines if there are too many tabs for one line.
Tabs component
Responsive horizontal navigation tabs, switch between contents with ease.
<o-tabs></o-tabs>
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
activateOnFocus | Set the tab active on navigation focus | boolean | - | false |
animateInitially | Apply animation on the initial render | boolean | - | From config: tabs: { |
animated | Tab will have an animation | boolean | - | From config: tabs: { |
animation | Transition animation name | [string, string, string, string] | [string, string] | [next , prev] , [right , left , down , up] | From config: tabs: { |
ariaLabel | Accessibility aria-label to be passed to the tablist wrapper element | string | - | From config: tabs: { |
expanded | Tabs will be expanded (full-width) | boolean | - | false |
v-model | The selected item value, use v-model to make it two-way binding | string|number|object | - | |
multiline | Show tab items multiline when there is no space | boolean | - | false |
options | Tabs options, unnecessary when default slot is used | OptionsProp<unknown> | - | |
override | Override existing theme classes completely | boolean | - | |
position | Position of the tabs | "centered" | "left" | "right" | left , centered , right | |
size | Tab size | string | small , medium , large | From config: tabs: { |
tag | Tablist tag name | DynamicComponent | - | From config: tabs: { |
type | Tab type | string | default , boxed , toggle , pills | From config: tabs: { |
variant | Color of the control | string | primary , info , success , warning , danger , and any other custom color | From config: tabs: { |
vertical | Show tab in vertical layout | boolean | - | From config: tabs: { |
Events
Event name | Properties | Description |
---|---|---|
update:model-value | value T - updated modelValue prop | modelValue prop two-way binding |
change | value T - new tab valuevalue T - old tab value | on tab change event |
Slots
Name | Description | Bindings |
---|---|---|
before | Additional slot before tabs | |
after | Additional slot after tabs | |
default | Place tab items here |
TabItem component
An tab item used by the tabs component.
<o-tab-item></o-tab-item>
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
component | Component to be injected. | Component | - | |
content | Text content, unnecessary when default slot is used | string | - | |
disabled | Item will be disabled | boolean | - | false |
events | Events to be binded to the injected component | {} | - | |
icon | Icon on the left | string | - | From config: tabs: { |
iconPack | Icon pack | string | - | From config: tabs: { |
label | Item label | string | - | |
override | Override existing theme classes completely | boolean | - | |
props | Props to be binded to the injected component | any | - | |
tag | Tabs item tag name | DynamicComponent | - | From config: tabs: { |
value | Item value (it will be used as v-model of wrapper component) - default is an uuid | string|number|object | - | |
visible | Show/hide item | boolean | - | true |
Events
Event name | Properties | Description |
---|---|---|
activate | on tab item activate event | |
deactivate | on tab item deactivate event |
Slots
Name | Description | Bindings |
---|---|---|
default | Override tab panel content | active boolean - if item is shown |
header | Override tab header label | active boolean - if item is shown |
Class Inspector
Class prop | Description | Props | Suffixes | |
---|---|---|---|---|
rootClass | Class of the root element. | |||
positionClass | Class of the root element with position. | position | bottom | |
sizeClass | Class of the root element with size. | size | small | |
typeClass | Class of the root element with type. | type | default | |
expandedClass | Class of the root element when expanded. | expanded | ||
verticalClass | Class of the root element when vertical. | vertical | ||
multilineClass | Class of the root element when multilined. | multiline | ||
listClass | Class of the list container element. | |||
contentClass | Class of the panel container element. | |||
transitioningClass | Class of the panel container element when transitioning. | |||
▷ tabClass | Class of the tab item element. | |||
▷ tabActiveClass | Class of the tab item element when active. | |||
▷ tabPreviousClass | Class of the tab item element before the active one. | |||
▷ tabNextClass | Class of the tab item element after the active one. | |||
▷ tabDisabledClass | Class of the tab item element when disabled. | disabled | ||
▷ tabIconClass | Class of the tab item icon element. | icon | ||
▷ tabLabelClass | Class of the tab item label element. | label | ||
▷ tabPanelClass | Class of the tab panel element. |
Sass variables
Current theme ➜ Oruga
SASS Variable | Default |
---|---|
$tabs-disabled-opacity | var(--#{$prefix}base-disabled-opacity) |
$tabs-font-size | var(--#{$prefix}base-font-size) |
$tabs-icon-margin | 0 0.5em 0 0 |
$tabs-content-padding | 1rem |
$tabs-margin-bottom | 1.5rem |
$tabs-border-bottom-color | var(--#{$prefix}grey-lighter) |
$tabs-border-bottom-style | solid |
$tabs-border-bottom-width | 1px |
$tabs-tab-color | hsl(0, 0%, 29%) |
$tabs-tab-active-border-bottom-color | var(--#{$prefix}primary) |
$tabs-tab-active-color | var(--#{$prefix}primary) |
$tabs-tab-padding | 0.5em 1em |
$tabs-boxed-tab-radius | var(--#{$prefix}base-border-radius) |
$tabs-boxed-tab-hover-background-color | hsl(0, 0%, 96%) |
$tabs-boxed-tab-hover-border-bottom-color | hsl(0, 0%, 86%) |
$tabs-boxed-tab-active-background-color | hsl(0, 0%, 100%) |
$tabs-boxed-tab-active-border-color | hsl(0, 0%, 86%) |
$tabs-boxed-tab-active-border-bottom-color | transparent |
$tabs-toggle-tab-border-color | hsl(0, 0%, 86%) |
$tabs-toggle-tab-border-style | solid |
$tabs-toggle-tab-border-width | 1px |
$tabs-toggle-tab-hover-background-color | hsl(0, 0%, 96%) |
$tabs-toggle-tab-hover-border-color | hsl(0, 0%, 71%) |
$tabs-toggle-tab-active-background-color | var(--#{$prefix}primary) |
$tabs-toggle-tab-active-border-color | var(--#{$prefix}primary) |
$tabs-toggle-tab-active-color | var(--#{$prefix}primary-invert) |
See ➜ 📄 Full scss file
Current theme ➜ Bulma
SASS Variable | Default |
---|---|
$tabs-focused-outline | none |
$tabs-link-focus-border-bottom-color | css.getVar( "tabs-link-hover-border-bottom-color") |
$tabs-link-focus-active-border-bottom-color | css.getVar( "tabs-link-active-border-bottom-color") |
$tabs-boxed-link-focus-active-background-color | css.getVar( "tabs-boxed-link-active-background-color") |
$tabs-boxed-link-focus-background-color | css.getVar( "tabs-boxed-link-hover-background-color") |
$tabs-boxed-link-focus-active-border-bottom-color | css.getVar( "tabs-boxed-link-active-border-bottom-color") |
$tabs-boxed-link-focus-border-bottom-color | css.getVar( "tabs-boxed-link-hover-border-bottom-color") |
$tabs-toggle-link-focus-active-background-color | css.getVar( "tabs-toggle-link-active-background-color") |
$tabs-toggle-link-focus-background-color | css.getVar( "tabs-toggle-link-hover-background-color") |
$tabs-toggle-link-focus-active-border-color | css.getVar( "tabs-toggle-link-active-border-color") |
$tabs-toggle-link-focus-border-color | css.getVar( "tabs-toggle-link-hover-border-color") |
See ➜ 📄 Full scss file
Current theme ➜ Bootstrap
SASS Variable | Default |
---|---|
$nav-tabs-color | var(--#{$prefix}body-color) |
$nav-tabs-spacer | $spacer |
$nav-tabs-disabled-opacity | 0.5 |
$nav-underline-link-active-bg | $nav-tabs-link-active-bg |
$nav-underline-link-active-border-color | currentcolor |
See ➜ 📄 Full scss file