Veil UI
Components

Tab Bar

Alias entry for Tabs, tuned for bar-style navigation.

Installation

$ npx veil-ui@latest add tab-bar

Usage

import {
  TabBar,
  TabBarContent,
  TabBarItem,
  TabBarList,
} from "@/components/ui/tab-bar";

<TabBar defaultValue="overview">
  <TabBarList>
    <TabBarItem value="overview">Overview</TabBarItem>
    <TabBarItem value="activity">Activity</TabBarItem>
  </TabBarList>
  <TabBarContent value="overview">Project overview.</TabBarContent>
  <TabBarContent value="activity">Recent activity.</TabBarContent>
</TabBar>;

Examples

Basic

Project overview.

With icons

Health, members and recent deploys.

API reference

The alias maps TabBar → Tabs, TabBarList → TabsList, TabBarItem → TabsTrigger and TabBarContent → TabsContent.

Accessibility

  • Inherits full Tabs behavior: roving focus, aria-selected and labelled tab panels.

Vue and plain HTML

This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add tab-bar --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