nb-tabs
This is a tabs component for Vue.js 3+.
Loading component...
Installation
Yarn
yarn add @vlalg-nimbus/nb-navigation
Usage
Vue 3
import { createApp } from 'vue'
import App from './App.vue'
import NbNavigationComponents from '@vlalg-nimbus/nb-navigation'
import "@vlalg-nimbus/nb-navigation/dist/style.css";
const app = createApp(App)
app.use(NbNavigationComponents)
app.mount('#app')
To use, simply call the component, in this case it will be NbTabs or nb-tabs.
Mode 1
<template>
<NbTabs
nb-id="tabs-1"
:tabs="tabs"
:active-tab="0"
:disabled-tabs="[2]"
tab-model="one"
/>
</template>
Preview & Playground
Select the component you want to edit/test
Loading Sandbox...
Props
Items with an (*) mean they are required
| name | Value type | Default | Description |
|---|---|---|---|
| nbId (*) | String | Sets the id attribute to differentiate from other components | |
| tabs (*) | Array | List of tab items. Each item must include key and label | |
| activeTab (*) | Number | 0 | Active tab index (0-based) |
| disabledTabs | Array | [] | Disabled tabs list (indexes or keys) |
| tabIndex | Number | 0 | Keyboard tab index applied to each tab item |
| hasTabIndexEnter | Boolean | true | Enables tab activation with Enter key |
| hasTabIndexSpace | Boolean | true | Enables tab activation with Space key |
| ariaLabel | String | 'Tab' | aria-label on the navigation wrapper (override for your app) |
| ariaAttrs | Object | {} | Additional aria attributes (auto-prefixed with aria-) |
| tabModel | String | 'one' | Tabs model. Accepts one only in this version |
| inputStyle | String | 'background' | Visual style. Accepts background, line, border |
| theme | String | 'light' | Component theme. Accepts light and dark |
| disabled | Boolean | false | Disables full component interaction |
| hasBorderRadius | Boolean | false | Enables border radius in non-line styles |
| borderRadius | Number | 0.375 | Border radius in rem |
| gap | Number | 24 | Gap between tabs in pixels |
| indicatorWidth | Number | 3 | Indicator thickness in pixels |
| barPaddingLeft | Number | 0 | Left padding (px) applied to the tabs bar/header |
| isScrollClass | Boolean | false | Enables horizontal scroll behavior on tabs header |
| scrollClass | String | '' | Optional custom CSS class applied to header when isScrollClass is enabled |
| paddingX | Number | 0.2 | Horizontal tab padding in rem |
| paddingY | Number | 0.2 | Vertical tab padding in rem |
| fontFamily | String | 'Lato', sans-serif | Font family |
| fontSize | String | '1.6em' | Base font size |
| fontWeight | Number | 400 | Base font weight |
| fontWeightActive | Number | 400 | Active tab font weight |
| opacityDisabled | Number | 0.2 | Disabled state opacity |
Theme Colors (Light)
| name | Value type | Default | Description |
|---|---|---|---|
| lightBgColor | String | #000000 | Bar / indicator background (inputStyle background) |
| lightBorderColor | String | #eaeaea | Bottom border / line (line style header line) |
| lightTabBorderColor | String | #000000 | Tab indicator edge (border style) |
| lightTextColor | String | #333333 | Inactive tab label color |
| lightTextColorActive | String | #ffffff | Active tab label color |
Theme Colors (Dark)
| name | Value type | Default | Description |
|---|---|---|---|
| darkBgColor | String | #353734 | Background color in dark theme |
| darkBorderColor | String | #5f5f5f | Header/border color in dark theme (aligned with NbSegmentedButton) |
| darkTabBorderColor | String | #353734 | Border color for tab indicator (border style) |
| darkTextColor | String | #c8c8c8 | Text color in dark theme |
| darkTextColorActive | String | #ebebeb | Active text color in dark theme |
| darkDisabledBorderColor | String | rgba(95, 95, 95, 0.45) | Disabled border color in dark theme |
Events
| name | Return type | Description |
|---|---|---|
| changed | { index: Number, key: String } | Fired when active tab changes |
Slots
Per-tab content overrides the default {{ tab.label }}.
| name | Scope | Description |
|---|---|---|
tab-{index} | { option, index, options } | option is the tab object (key, label); options is the full tabs array |
Notes
- In the current implementation,
NbTabsrenders the tab header and indicator only. - The content rendering flow is external by design: use your own
v-ifrendering and react to thechangedevent (index/key) to display the active panel. - When
isScrollClassistrue, the tabs header supports horizontal drag-to-scroll with mouse.
