Switch between related views without leaving the page.
$ pnpm dlx shadcn@latest add https://dashral.com/r/tabs.jsonInstallation
$ pnpm dlx shadcn@latest add https://dashral.com/r/tabs.jsonAdds the component, the components it builds on, its npm packages and the theme tokens it uses. Using Dashral often? Add the registry to components.json once:
{
"registries": {
"@dashral": "https://dashral.com/r/{name}.json"
}
}Then add components by name:
$ pnpm dlx shadcn@latest add @dashral/tabsUsage
import { Tabs } from "@/components/dashral/tabs"
<Tabs
items={[
{ value: "overview", label: "Overview", content: <Overview /> },
{ value: "activity", label: "Activity", badge: 3, content: <Activity /> },
]}
/>Examples
Metrics panel
variant="line" with icons; listAction holds a period switch that changes every tab, and the chart redraws.
API reference
Tabs
Also takes every prop of Radix Tabs(opens in a new tab).
| Prop | Type | Default |
|---|---|---|
items | { value, label, icon?, badge?, disabled?, content? }[]The tabs and their panels. Without content, it's just the row. | — |
value / defaultValue | string | the first tab |
onValueChange | (value: string) => voidCalled with the new value. | — |
variant | "default" | "line"A raised card on a muted track, or plain tabs with a sliding underline. | "default" |
orientation | "horizontal" | "vertical"vertical: the tabs in a column beside their panel; the card or a line at their start edge glides up and down. | "horizontal" |
fullWidth | booleanThe row fills the width. | false |
listAction | ReactNodeAt the end of the tab row. | — |
children | ReactNodeMore content under the panels. | — |
classNames | { header, list, trigger, content }Classes for each part. | — |
className | stringExtra classes, merged with cn() so yours win. | — |
Keyboard
| Keys | Action |
|---|---|
| Tab | Into the tab list, then into the panel |
| ←or→ | Move between tabs (and show them) |
| ↑or↓ | The same, with orientation="vertical" |
| HomeorEnd | First / last tab |
Accessibility
- role="tablist" / "tab" / "tabpanel", with each panel labelled by its tab; a vertical list says so (aria-orientation).
Motion
- The selected tab's card (or underline) glides to the tab you pick (--duration-considered, --ease-standard), and the new panel fades in from a soft blur. With reduced motion they just switch.