CraftUI

Tabs

Horizontal tabs as a dark tab bar or a segmented row of choices.

Your saved worlds appear here.

Installation

npx shadcn@latest add @runqora/craft-tabs

Usage

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

<Tabs defaultValue="worlds">
  <TabsList>
    <TabsTrigger value="worlds">Worlds</TabsTrigger>
    <TabsTrigger value="realms">Realms</TabsTrigger>
  </TabsList>
  <TabsContent value="worlds">Your worlds</TabsContent>
  <TabsContent value="realms">Your realms</TabsContent>
</Tabs>;

Examples

Segmented

Gather, craft and survive.

Props

TabsList

Prop

Type

TabsTrigger

Prop

Type

Tabs

Prop

Type

Accessibility

  • Left and Right move between tabs, Home and End jump to the ends, and Enter or Space selects. Set activateOnFocus on TabsList to select as focus moves.
  • Tab moves from the list into the open panel.
  • A disabled tab can take focus, so screen reader users can find it, but it can't be selected.
  • The selected tab has an underline and a sunken shape as well as its color.

Customization

TabsList scrolls sideways when the tabs don't fit. For fixed-width tabs, override the width on each trigger.

<TabsTrigger className="flex-none basis-40" value="worlds">
  Worlds
</TabsTrigger>

Dependencies

Source

On this page