Components
Tabs
Radix tabs for switching between related panels.
Ombelle · light
Project sections
Your project is ready to preview.
Project overview.
Installation
Run in a project initialized with an Ombelle preset (see Get started). The component uses the saved project preset. Run the command from your app folder; it shows the changes and asks before writing.
pnpm dlx @ombelle-ui/cli@1.1.2 add tabsAdds components/ui/tabs.tsx and installs react, @radix-ui/react-tabs, clsx, tailwind-merge with lifecycle scripts disabled. This is a client component.
In a liquid glass project the plan adds a notice that accessibility is not guaranteed, because text contrast depends on the background behind the glass.
Usage
example.tsx
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'
export function ProjectSections() {
return (
<Tabs defaultValue="overview">
<TabsList aria-label="Project sections">
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="activity">Activity</TabsTrigger>
</TabsList>
<TabsContent value="overview">Project overview.</TabsContent>
<TabsContent value="activity">Recent activity.</TabsContent>
</Tabs>
)
}
// appearance="underline" draws a line under the active tab instead of a container.
export function UnderlineSections() {
return (
<Tabs defaultValue="overview">
<TabsList appearance="underline" aria-label="Underline sections">
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="activity">Activity</TabsTrigger>
</TabsList>
<TabsContent value="overview">Project overview.</TabsContent>
<TabsContent value="activity">Recent activity.</TabsContent>
</Tabs>
)
}API and states
- API
- Tabs (defaultValue, orientation), TabsList (appearance: contained, underline, pills), TabsTrigger, TabsCount, TabsContent
- Minimum states
- Active, inactive, focus, disabled, vertical, pills with counts
- Native basis
- Reviewed Radix tabs primitive
- Styles
- Stable in Ombelle, Papier, Organic, Retro futurism, minimalist, neo-brutalism and flat, light and dark. Liquid glass: stable, accessibility not guaranteed.