Tabs
Tabs whose underline is forty pixels that stream from the old tab to the new one, with panels that slide in from the side.
Playground
Change a prop and the component re-renders. Props marked remounts set an initial value, so the component starts over.
<PxTabs
items={[
{
label: "Overview",
content: "Usage is steady this week. Most runs come from the Research project."
},
{
label: "Activity",
count: 12,
content: "12 events since Monday, including 3 deploys and 2 new members."
},
{
label: "Settings",
content: "Default model, retention and notification settings live here."
}
]}
defaultValue="Overview"
/>Installation
pnpm dlx shadcn@latest add @lumesec/px-tabsFirst timeRegister the @lumesec registry once, or install by URL+
Adds @lumesec to your components.json:
pnpm dlx shadcn@latest registry add @lumesec=https://elements.lumesec.ai/r/{name}.jsonOr skip the setup and install by URL:
npx shadcn@latest add https://elements.lumesec.ai/r/px-tabs.jsonUsage
import { PxTabs } from "@/components/lumesec/px-tabs";
export function Example() {
return (
<PxTabs
items={[
{ label: "Overview", content: "Usage is steady this week." },
{ label: "Activity", count: 12, content: "12 events since Monday." },
{ label: "Settings", content: "Default model, retention and notifications." },
]}
/>
);
}Behaviour
The underline is forty pixels that stream from the old tab to the new one. Each item brings its own panel content.
API reference
Props
Also accepts every prop of <div> (React.ComponentProps<"div">), spread onto the root element.
valueTypestringControlled selected tab (an item's value, or its label). Use with onValueChange.
defaultValueTypestringDefaultfirst tabInitially selected tab when uncontrolled.
itemsTypereadonly PxTabsItem[]The tabs: { value?: string; label: string; count?: string | number; content: React.ReactNode }. value defaults to label; count adds a small badge after the label.
onValueChangeType(value: string) => voidCalled when the user selects another tab by click or key.
Ref
ref points at the root HTMLDivElement.
Keyboard
| Keys | Action |
|---|---|
| ArrowRight / ArrowLeft | Select and focus the next / previous tab, wrapping. |
| Home / End | Select and focus the first / last tab. |
Accessibility
- Tabs are native buttons with
role="tab"andaria-selectedin arole="tablist", with roving tabindex: only the selected tab is in the tab order. - Each tab points to its panel with
aria-controls. Panels haverole="tabpanel", anaria-labelwith the tab name andtabindex="0"; inactive panels arehidden. - The underline canvas is
aria-hidden. - Reduced motion: the underline jumps to the new tab and the panel appears without sliding in.
Theming
Styled with Tailwind classes on your shadcn theme tokens, so light and dark follow your theme. The accent comes from --lumesec. See Theming.
This component reads --lumesec, --lumesec-shine, --foreground, --muted-foreground and --border.
Notes
- Every panel stays mounted; inactive ones are hidden, so their state survives switching tabs.
- Selecting the tab that is already selected does nothing.
Related
Was this page helpful?