Tabs
NavigationSwitches between related content panels while keeping the available views visible.
Try it
Add to your project
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/tabs.jsonThe command includes the component’s shared dependencies. Your project keeps editable source files.
Include the complete example
This example also composes card. Install its parts together:
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/tabs.json https://luv-jeri.github.io/cojeev-ui/r/card.jsonUsing tabs
Match each TabsTrigger value to a TabsContent value inside a shared Tabs root.
Use value and onValueChange when another control needs to select a view, and choose a variant for its visual hierarchy.
Panel changes use the shared presence transition. Exiting panels become inert and leave after their exit; forceMount opts into consumer-managed visibility.
API
Compose the exported parts below. The prop types are read from the React source during the registry build.
Native element or underlying primitive props are inherited where declared, including accessible labels, event handlers and refs.
TabsProps
| Prop | Type | Required |
|---|---|---|
variant | "default" | "pills" | "underline" | "lenses" | null | undefined | No |
TabsListProps
| Prop | Type | Required |
|---|---|---|
variant | "default" | "pills" | "underline" | "lenses" | null | undefined | No |
TabsTriggerProps
Accepts the native or primitive props declared by its exported TypeScript type.
TabsContentProps
Accepts the native or primitive props declared by its exported TypeScript type.
Accessibility
Give TabsList a descriptive accessible name and preserve the supplied trigger and panel relationships for keyboard navigation.
States and appearance
For conditional content, keep a MotionPresence boundary around keyed MotionSurface children. The shared entrance and exit states work with native primitives and respect your motion preference.
Try pointer and keyboard interaction, and switch the appearance control in the navigation to compare light and dark mode. Motion respects reduced motion preferences.