Tabs

GitHub
Organize related content in interactive tabbed interfaces.

Usage

Use the tabs and tabs-item components to display Tabs in your content.

::callout
Lorem velit voluptate ex reprehenderit ullamco et culpa.
::
::tabs

:::tabs-item{label="Code" icon="i-lucide-code"}

```mdc
::callout
Lorem velit voluptate ex reprehenderit ullamco et culpa.
::
```

:::

:::tabs-item{label="Preview" icon="i-lucide-eye"}

::callout
Lorem velit voluptate ex reprehenderit ullamco et culpa.
::

:::

::

API

Props

Prop Default Type
defaultValue'0' string

The default tab to select.

sync string

Sync the selected tab with a local storage key.

hash string

The hash to scroll to when the tab is selected.

modelValue string
ui { root?: ClassNameValue; } & { root?: ClassNameValue; list?: ClassNameValue; indicator?: ClassNameValue; trigger?: ClassNameValue; leadingIcon?: ClassNameValue; leadingAvatar?: ClassNameValue; leadingAvatarSize?: ClassNameValue; label?: ClassNameValue; trailingBadge?: ClassNameValue; trailingBadgeSize?: ClassNameValue; content?: ClassNameValue; }

Slots

Slot Type
default{}

Theme

app.config.ts
export default defineAppConfig({
  ui: {
    prose: {
      tabs: {
        slots: {
          root: 'my-5 gap-4'
        }
      },
      tabsItem: {
        base: '*:first:mt-0 *:last:mb-0 *:my-1.5'
      }
    }
  }
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'

export default defineConfig({
  plugins: [
    vue(),
    ui({
      ui: {
        prose: {
          tabs: {
            slots: {
              root: 'my-5 gap-4'
            }
          },
          tabsItem: {
            base: '*:first:mt-0 *:last:mb-0 *:my-1.5'
          }
        }
      }
    })
  ]
})

Changelog

Soon
  • 33dd6 — chore(deps): update nuxt framework to ^4.3.1 (#6048)
  • c9704 — feat(Theme): new component (#4387)
v4.4.0
  • 55646 — feat(components): add valueKey prop (#5905)
v4.2.0
  • dd81d — feat(components): add data-slot attributes (#5447)
  • 5b177 — feat(components): extend native HTML attributes (#5348)
  • e5c11 — fix(ContentNavigation/NavigationMenu/Tabs): ensure proper badge display
v4.1.0
  • 63c0a — feat(components): expose ui in slot props where used (#5207)
v4.0.0
  • 340fc — fix(Tabs): use nullish coalescing on item value
v3.3.4
  • 11a03 — fix(components): dot notation type support for labelKey and valueKey (#4933)
v3.3.3
  • 61b60 — feat(Icon): allow passing a component instead of a name (#4766)
v3.3.1
  • 5cb65 — feat: import @nuxt/ui-pro components (#4675)
  • fbec2 — fix(Tabs): add missing Badge import (#4594)
v3.3.0
  • b2289 — fix(NavigationMenu/Tabs): display badge when not undefined
  • 62ab0 — feat(Tabs): add badge on items (#4553)
v3.2.0
  • 7a2bd — feat(Select/SelectMenu/Tabs): expose trigger refs
v3.1.2
  • b9adc — feat(components): add ui field in items (#4060)
  • 999a0 — fix(Tabs): set focus:outline-none with link variant
  • e6e51 — fix(components): class should have priority over ui prop
  • 06e56 — fix(Tabs): prevent trigger truncate without parent width
v3.1.0
  • d49e0 — feat(module): define neutral utilities (#3629)
  • f9737 — feat(module): dynamic rounded-* utilities (#3906)
  • 39c86 — fix(components): refactor types after @nuxt/module-builder upgrade (#3855)
  • 3447a — feat(Tabs): add list-leading and list-trailing slots (#3837)
v3.0.2
  • b9983 — fix(components): improve generic types (#3331)
  • 1769d — fix(Tabs): remove focus:outline-hidden class
v3.0.1
  • ef861 — chore(components): add eol in script tag to fix syntax highlight