Tabs

A compact segmented navigation component for switching between views.

Installation

npx alixan-ui-nuxt add tabs

Usage

<script setup lang="ts">
import Tabs from '@/components/ui/tabs/Tabs.vue'

const tabs = ['Account', 'Password']
const selected = ref(0)
</script>

<template>
  <div class="grid gap-4">
    <Tabs v-model="selected" :tabs="tabs" design="cupertino" />
    <Tabs v-model="selected" :tabs="tabs" design="material" />
  </div>
</template>

Full Width

<script setup lang="ts">
import Tabs from '@/components/ui/tabs/Tabs.vue'
</script>

<template>
  <Tabs v-model="selected" :tabs="tabs" full />
</template>

Swipeable tabs

Drag the tab row with touch or mouse, with momentum and automatic positioning of the selected tab. Buttons stay on one line at their content width. Swiping only moves the row; select a tab by clicking it. TabsSwiper has no full option and requires Swiper. Install the dependency before adding the component.

npm install swiper@^12.2.0
npx alixan-ui-nuxt add tabs-swiper

All products

All products

<script setup lang="ts">
import TabsSwiper from '@/components/ui/tabs/TabsSwiper.vue'

const tabs = [
  'componentDocs.tabs.demo.all',
  'componentDocs.tabs.demo.active',
  'componentDocs.tabs.demo.paused',
  'componentDocs.tabs.demo.problems',
  'componentDocs.tabs.demo.belowMinimum',
  'componentDocs.tabs.demo.atMinimum',
  'componentDocs.tabs.demo.favorites',
]
const counts = [128, 84, 16, 9, 7, 12, 18]
const selected = ref(0)
</script>

<template>
  <TabsSwiper v-model="selected" :tabs="tabs" :counts="counts" design="material" />
  <p>{{ $t(tabs[selected]) }}</p>
</template>

API Reference

PropTypeDefaultDescription
modelValuenumber0Selected tab index used by v-model.
tabsstring[][]List of tab labels.
design'material' | 'cupertino''cupertino'Visual style of the tabs.
fullbooleanfalseMakes the tabs container and every tab use full available width.

TabsSwiper props

PropTypeDefaultDescription
modelValuenumber0Selected tab index used by v-model.
tabsstring[][]List of tab labels.
design'material' | 'cupertino''cupertino'Visual style of the tabs.
countsnumber[]undefinedOptional counts displayed next to tab labels, in the same order as tabs. Zero values are shown.