Skip to content
Cojeev UI

Tabs

Navigation

Switches between related content panels while keeping the available views visible.

React · copy into your project · light and dark themes

Try it

Loading preview…

Take it with you

Copy the example, API and usage notes for your editor or AI assistant.

Add to your project

Terminal
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/tabs.json

The 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:

Terminal
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/tabs.json https://luv-jeri.github.io/cojeev-ui/r/card.json

Using 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

PropTypeRequired
variant"default" | "pills" | "underline" | "lenses" | null | undefinedNo

TabsListProps

PropTypeRequired
variant"default" | "pills" | "underline" | "lenses" | null | undefinedNo

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

selectedresthoverfocusactiveon

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.