Tabs
Underline or pill tabs with keyboard arrows; optional panels via `content`.
Code
import * as React from 'react';
import { Tabs } from '@fruit-labs/design';
export default function Demo() {
return (
<div
style={{
display: 'flex',
flexDirection: 'column',
gap: 20,
}}
>
<Tabs
tabs={[
'Overview',
'Activity',
{
value: 'files',
label: 'Files',
count: 12,
},
'Settings',
]}
/>
<Tabs variant="pill" tabs={['All', 'Open', 'Closed']} defaultValue="Open" />
</div>
);
}With content
import { Tabs } from '@fruit-labs/design';
export default function Example() {
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: 12, maxWidth: 560 }}>
<Tabs tabs={[
{ value: 'a', label: 'Profile', content: <p>Your public details.</p> },
{ value: 'b', label: 'Billing', content: <p>Cards and invoices.</p> },
]} />
</div>
);
}Install
From npm:
npm install @fruit-labs/design
import { Tabs } from '@fruit-labs/design';Or copy the TypeScript source into your project:
npx shadcn@latest add https://design.fruitlabs.online/r/tabs.jsonGuidelines
- Underline for page sections; pill for compact switching inside a card.
Props
| Prop | Type | Required |
|---|---|---|
tabs | Array<string | { value: string; label: React.ReactNode; icon?: string; count?: number; content?: React.ReactNode }> | Yes |
value | string | No |
defaultValue | string | No |
onChange | (value: string) => void | No |
variant | 'underline' | 'pill' | No |
className | string | No |
style | React.CSSProperties | No |