Tabs
Switch between related content in the same context.
npx shadcn@latest add @silicon-ui/tabsInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/tabsManually
Install the dependencies
npm install @radix-ui/react-tabs lucide-react motionCopy these files into your project
- components/silicon-ui/tabs/tabs.tsx
- components/silicon-ui/tabs/tabs.module.css
Shared with other components. Skip any you already have.
- components/silicon-ui/lib/fluid-hover.tsx
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
Tabs
Accepts the props of TabsProps.
TabsList
Accepts the props of TabsListProps.
TabsTrigger
| Prop | Type | Default |
|---|---|---|
iconAn icon before the label, such as a 16px Lucide icon. It is sized, coloured with the label (muted, then the active colour when selected) and hidden from screen readers. For an icon-only tab, leave out the label and pass `aria-label`. | ReactNode | — |
Also accepts the props of ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>.
TabsContent
Accepts the props of TabsContentProps.