Tabs
Tabs organise content into named sections that the user can switch between without leaving the page.
import { Tabs } from '@/components/ui/wideset/tabs/Tabs';
<Tabs defaultValue="overview">
<Tabs.List>
<Tabs.Item value="overview">
<Tabs.Label>Overview</Tabs.Label>
</Tabs.Item>
<Tabs.Item value="members">
<Tabs.Label>Members</Tabs.Label>
<Tabs.Count>8</Tabs.Count>
</Tabs.Item>
<Tabs.Item value="comments">
<Tabs.Label>Comments</Tabs.Label>
<Tabs.Count>12</Tabs.Count>
</Tabs.Item>
</Tabs.List>
<Tabs.Content value="overview">Project summary, milestones and recent activity.</Tabs.Content>
<Tabs.Content value="members">Everyone with access to this project.</Tabs.Content>
<Tabs.Content value="comments">Feedback left on designs and documents.</Tabs.Content>
</Tabs>Installation
pnpm dlx wideset add tabs
Copies the component and any Wideset components it uses into your project.
Examples
Types
Regular underlines the active tab and fits the tabs to their labels; it is the default for sections of a page. Full width shares the width evenly, for two to four tabs in a narrow panel. Pills fill the active tab, for a compact switcher. Ghost has no border: a soft background slides to the active tab, for cards and toolbars. Pills and ghost ignore divider.
import { Tabs } from '@/components/ui/wideset/tabs/Tabs';
export default function TabsTypes() {
return (
<div className="gap-ws-16 flex w-[24rem] max-w-full flex-col">
{(['regular', 'fullWidth', 'pills', 'ghost'] as const).map((type) => (
<Tabs key={type} type={type} defaultValue="overview">
<Tabs.List>
<Tabs.Item value="overview">
<Tabs.Label>Overview</Tabs.Label>
</Tabs.Item>
<Tabs.Item value="members">
<Tabs.Label>Members</Tabs.Label>
</Tabs.Item>
<Tabs.Item value="comments">
<Tabs.Label>Comments</Tabs.Label>
</Tabs.Item>
</Tabs.List>
</Tabs>
))}
</div>
);
}Sizes
Small is the default, with a compact label for panels and dense screens. Large gives the tabs more height and a larger label, for the top level of a page; use one size per screen.
import { Tabs } from '@/components/ui/wideset/tabs/Tabs';
export default function TabsSizes() {
return (
<div className="gap-ws-12 flex w-[24rem] max-w-full flex-col">
{(['sm', 'lg'] as const).map((size) => (
<Tabs key={size} size={size} defaultValue="overview">
<Tabs.List>
<Tabs.Item value="overview">
<Tabs.Label>Overview</Tabs.Label>
</Tabs.Item>
<Tabs.Item value="members">
<Tabs.Label>Members</Tabs.Label>
</Tabs.Item>
<Tabs.Item value="comments">
<Tabs.Label>Comments</Tabs.Label>
</Tabs.Item>
</Tabs.List>
</Tabs>
))}
</div>
);
}Icons
An icon goes before the label and is hidden from screen readers, so the label still names the tab. A count goes after the label and becomes part of the tab's accessible name; use it for how many items wait behind the tab, not for a status. Give every tab an icon or none.
import { RiChat3Line, RiFileList3Line, RiTeamLine } from '@remixicon/react';
import { Tabs } from '@/components/ui/wideset/tabs/Tabs';
export default function TabsIcons() {
return (
<div className="gap-ws-12 flex w-[24rem] max-w-full flex-col">
<Tabs defaultValue="overview">
<Tabs.List>
<Tabs.Item value="overview">
<Tabs.Icon icon={RiFileList3Line} />
<Tabs.Label>Overview</Tabs.Label>
</Tabs.Item>
<Tabs.Item value="members">
<Tabs.Icon icon={RiTeamLine} />
<Tabs.Label>Members</Tabs.Label>
</Tabs.Item>
<Tabs.Item value="comments">
<Tabs.Icon icon={RiChat3Line} />
<Tabs.Label>Comments</Tabs.Label>
</Tabs.Item>
</Tabs.List>
</Tabs>
<Tabs defaultValue="overview">
<Tabs.List>
<Tabs.Item value="overview">
<Tabs.Label>Overview</Tabs.Label>
</Tabs.Item>
<Tabs.Item value="members">
<Tabs.Label>Members</Tabs.Label>
<Tabs.Count>8</Tabs.Count>
</Tabs.Item>
<Tabs.Item value="comments">
<Tabs.Label>Comments</Tabs.Label>
<Tabs.Count>12</Tabs.Count>
</Tabs.Item>
</Tabs.List>
</Tabs>
</div>
);
}States
disabled on one Tabs.Item takes that tab out of the keyboard order while the others keep working; disabled on Tabs disables every tab at once. Keep a disabled tab only when the user can tell why it is unavailable.
import { Tabs } from '@/components/ui/wideset/tabs/Tabs';
export default function TabsStates() {
return (
<div className="gap-ws-12 flex w-[24rem] max-w-full flex-col">
<Tabs defaultValue="overview">
<Tabs.List>
<Tabs.Item value="overview">
<Tabs.Label>Overview</Tabs.Label>
</Tabs.Item>
<Tabs.Item value="members" disabled>
<Tabs.Label>Members</Tabs.Label>
</Tabs.Item>
<Tabs.Item value="comments">
<Tabs.Label>Comments</Tabs.Label>
</Tabs.Item>
</Tabs.List>
</Tabs>
<Tabs disabled defaultValue="overview">
<Tabs.List>
<Tabs.Item value="overview">
<Tabs.Label>Overview</Tabs.Label>
</Tabs.Item>
<Tabs.Item value="members">
<Tabs.Label>Members</Tabs.Label>
</Tabs.Item>
<Tabs.Item value="comments">
<Tabs.Label>Comments</Tabs.Label>
</Tabs.Item>
</Tabs.List>
</Tabs>
</div>
);
}API reference
Tabs
| Name | Description | Default |
|---|---|---|
defaultMotion | Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`. boolean | true |
disabled | Disables all tab items. Individual items can still be disabled via `Tabs.Item`. boolean | false |
divider | Whether to render a bottom border beneath the tab list. Ignored when `type` is `pills` or `ghost`. boolean | true |
size | Size of the tabs, controls label typography and padding. 'sm''lg' | 'sm' |
type | Visual style variant of the tabs. - `regular` — underline indicator, tabs aligned to content width - `fullWidth` — underline indicator, tabs stretch to fill the container - `pills` — pill-shaped tabs with background fill on the active item - `ghost` — borderless tabs; a soft background slides to the active item 'ghost''regular''fullWidth''pills' | 'regular' |
Radix Tabs.Root is passed through to it. See Radix Tabs.Root.Tabs.Content
Radix Tabs.Content is passed through to it. See Radix Tabs.Content.Tabs.Count
| Name | Description | Default |
|---|---|---|
children | Count displayed inside the badge. ReactNode | — |
className | Additional CSS classes for layout overrides. string | — |
Tabs.Item
| Name | Description | Default |
|---|---|---|
value* | The value that identifies this tab. string | — |
disabled | Disables this specific tab item. Overrides the parent `Tabs` `disabled` prop. boolean | — |
Radix Tabs.Trigger is passed through to it. See Radix Tabs.Trigger.Tabs.List
Radix Tabs.List is passed through to it. See Radix Tabs.List.Accessibility
- Radix gives the
tablist/tab/tabpanelroles and arrow-key navigation; use the parts, not plain buttons. Tabs.Iconis hidden from screen readers; the label names the tab. Do not ship icon-only tabs.
| Part | Renders | Description |
|---|---|---|
| TabsRenders no element | Radix Tabs.Root | Named sections displayed one at a time. |
| Tabs.ContentRenders no element | Radix Tabs.Content | The content surface rendered within `Tabs`. |
| Tabs.CountRenders no element | — | A count displayed beside a tab label. |
| Tabs.ItemRenders no element | Radix Tabs.Trigger | An individual item within `Tabs`. |
| Tabs.ListRenders no element | Radix Tabs.List | The container arranging tab triggers. |
import { Tabs } from '@/components/ui/wideset/tabs/Tabs';
<Tabs defaultValue="overview">
<Tabs.List>
<Tabs.Item value="overview">
<Tabs.Label>Overview</Tabs.Label>
</Tabs.Item>
<Tabs.Item value="members">
<Tabs.Label>Members</Tabs.Label>
<Tabs.Count>8</Tabs.Count>
</Tabs.Item>
<Tabs.Item value="comments">
<Tabs.Label>Comments</Tabs.Label>
<Tabs.Count>12</Tabs.Count>
</Tabs.Item>
</Tabs.List>
<Tabs.Content value="overview">Project summary, milestones and recent activity.</Tabs.Content>
<Tabs.Content value="members">Everyone with access to this project.</Tabs.Content>
<Tabs.Content value="comments">Feedback left on designs and documents.</Tabs.Content>
</Tabs>