Skip to main content

Starwind UI v1.12 is now available!

Tabs

Installation

Usage

Synced Tabs

Use the syncKey prop to synchronize multiple tab groups. All tabs with the same syncKey will update together.

Disabled Triggers

Use the disabled attribute to prevent a tab from being selected.

Nested Tabs

Show how tabs can be nested by placing a Tabs component inside a TabsContent panel.

API Reference

Tabs

The root component that manages tab state.

PropTypeDefault
defaultValuestring-
syncKeystring-
classstring-
<Tabs defaultValue="astro" class="max-w-[400px]">
<!-- TabsList and TabsContent -->
</Tabs>

Additional Notes:

  • defaultValue: The tab value that should be active initially
  • syncKey: When provided, allows multiple Tabs instances with the same key to stay in sync

TabsList

Wraps TabsTrigger components.

PropTypeDefault
classstring-
<TabsList>
<TabsTrigger value="astro">Astro</TabsTrigger>
<TabsTrigger value="next">Next.js</TabsTrigger>
</TabsList>

TabsTrigger

Single tab trigger button.

PropTypeDefault
valuestringRequired
disabledbooleanfalse
classstring-
<TabsTrigger value="astro">Astro</TabsTrigger>

Additional Notes:

  • value: Identifier that links this trigger to a matching TabsContent panel

TabsContent

Content panel associated with a trigger.

PropTypeDefault
valuestringRequired
classstring-
<TabsContent value="astro">
Astro tab content
</TabsContent>

Additional Notes:

  • value: Must match the TabsTrigger value to be shown when that tab is active

Changelog

v1.4.0

  • style and focus state updates

v1.3.0

  • Add a data-slot attribute to all components to enable global styling updates

v1.2.0

  • Add support for nested tabs

v1.1.1

  • Small script cleanup

v1.1.0

  • tailwind-variants now implemented. This uses tailwind-merge under the hood to merge Tailwind classes without style conflicts, allowing you to override any existing classes using the “class” prop.