UIPackage
Menu

Framework

Change language

Boilerplate repo

Tabs

tabsui

Horizontal tab navigation with content panels — pick one panel at a time. Underline or pills variants. Built on reka-ui with full keyboard navigation.

Also available for React ->

Installation

$npx shadcn-vue@latest add https://uipkge.dev/r/vue/tabs.json
Named registry:npx shadcn-vue@latest add @uipkge/tabsInstalls to:app/components/ui/tabs/

Examples

Loading interactive previews…

Props

NameType / ValuesDefaultRequired
variantsegmentedoptional
classHTMLAttributes['class']optional
orientation
'horizontal''vertical'
optional

Used by

Files installed (6)

  • app/components/ui/tabs/Tabs.vue1.2 kB
    <script setup lang="ts">
    import { computed, provide } from 'vue'
    import type { TabsRootEmits, TabsRootProps } from 'reka-ui'
    import type { HTMLAttributes } from 'vue'
    import { reactiveOmit } from '@vueuse/core'
    import { TabsRoot, useForwardPropsEmits } from 'reka-ui'
    import { cn } from '@/lib/utils'
    
    const props = defineProps<
      TabsRootProps & {
        class?: HTMLAttributes['class']
        orientation?: 'horizontal' | 'vertical'
      }
    >()
    const emits = defineEmits<TabsRootEmits>()
    
    const delegatedProps = reactiveOmit(props, 'class', 'orientation')
    const forwarded = useForwardPropsEmits(delegatedProps, emits)
    
    // Make orientation reachable from descendants without each consumer having to
    // pass it manually. TabsList / TabsTrigger inject this to apply variant CSS.
    provide(
      Symbol.for('tabsOrientation'),
      computed(() => props.orientation ?? 'horizontal'),
    )
    </script>
    
    <template>
      <TabsRoot
        data-uipkge
        data-slot="tabs"
        :data-orientation="orientation ?? 'horizontal'"
        :orientation="orientation ?? 'horizontal'"
        v-bind="forwarded"
        :class="cn('flex w-full', orientation === 'vertical' ? 'flex-row gap-4' : 'flex-col gap-2', props.class)"
      >
        <slot />
      </TabsRoot>
    </template>
    
  • app/components/ui/tabs/TabsContent.vue1 kB
  • app/components/ui/tabs/TabsList.vue6.1 kB
  • app/components/ui/tabs/TabsTrigger.vue1.4 kB
  • app/components/ui/tabs/tabs.variants.ts4.3 kB
  • app/components/ui/tabs/index.ts0.5 kB

Raw manifest:https://uipkge.dev/r/vue/tabs.json