Veil UI
Components

Tabs

Layered sections of content, one visible at a time.

Installation

$ npx veil-ui@latest add tabs

Usage

import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";

<Tabs defaultValue="account">
  <TabsList>
    <TabsTrigger value="account">Account</TabsTrigger>
  </TabsList>
  <TabsContent value="account">...</TabsContent>
</Tabs>;

Examples

Basic

This name is visible to your team.

With icons

Manage your public profile and avatar.

Vertical

Project name, region and visibility.

API reference

PropTypeDefaultDescription
value / defaultValuestring—Controlled or initial tab.
orientation"horizontal" | "vertical""horizontal"Arrow-key axis for the tab list.
onValueChange(value: string) => void—Called when the active tab changes.

Accessibility

  • Implements the WAI-ARIA tabs pattern: roving tabindex, arrow keys, Home and End.
  • TabsList should have an aria-label when the page has more than one tab set.
  • Panels are focusable and labelled by their trigger.

Vue and plain HTML

This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add tabs --framework vue or switch the framework in components.json.

<script setup lang="ts">
import { TabsContent } from "reka-ui";

import { cn } from "@/lib/utils";

const props = defineProps<{ class?: string; value: string }>();
</script>

<template>
  <TabsContent
    data-slot="tabs-content"
    :value="value"
    :class="
      cn(
        'flex-1 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 data-[state=active]:animate-in data-[state=active]:fade-in-0',
        props.class,
      )
    "
  >
    <slot />
  </TabsContent>
</template>

On this page