Veil UI
Components

Tab

Alias entry for the Tabs primitives.

Installation

$ npx veil-ui@latest add tab

Usage

import { Tab, TabContent, TabList, TabTrigger } from "@/components/ui/tab";

<Tab defaultValue="account">
  <TabList>
    <TabTrigger value="account">Account</TabTrigger>
    <TabTrigger value="password">Password</TabTrigger>
  </TabList>
  <TabContent value="account">Account settings.</TabContent>
  <TabContent value="password">Password settings.</TabContent>
</Tab>;

Examples

Basic

Update your account details.

With icons

Update your profile and email address.

API reference

Tab, TabList, TabTrigger and TabContent re-export the Tabs primitives.

Accessibility

  • Radix Tabs provides tablist / tab / tabpanel semantics, arrow-key navigation and focus management.

Vue and plain HTML

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

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

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

defineOptions({ inheritAttrs: false });

const props = defineProps<{
  defaultValue?: string | number;
  modelValue?: string | number;
  orientation?: "horizontal" | "vertical";
  dir?: "ltr" | "rtl";
  activationMode?: "automatic" | "manual";
  asChild?: boolean;
  class?: string;
}>();

const emit = defineEmits<{ "update:modelValue": [value: string | number] }>();
</script>

<template>
  <TabsRoot
    v-bind="$attrs"
    data-slot="tabs"
    :default-value="props.defaultValue"
    :model-value="props.modelValue"
    :orientation="props.orientation"
    :dir="props.dir"
    :activation-mode="props.activationMode"
    :as-child="props.asChild"
    :class="cn('flex flex-col gap-2', props.class)"
    @update:model-value="emit('update:modelValue', $event)"
  >
    <slot />
  </TabsRoot>
</template>

On this page