Tabs: underline (default), pill or neutral pill, with optional icons and counts and a sliding indicator. Tabs switch content on the page; LinkTabs when each tab is its own page.
Icons and counts
Each tab can take a leading icon and a trailing count; the selected tab turns orange and the 2px bar slides under it.
Files for the Denzing brand refresh.
Installation
Copies the component into src/design-system/ as your own source, with only the files it needs.
npx avesk-ui@latest add tabsBrings the 1 file it builds on (skeleton.tsx). The first time, it also adds the tokens and the cn() helper, imports the tokens in globals.css and installs clsx and tailwind-merge. Files already in your project are kept unless you add --force.
Import
Lives in src/design-system/components/tabs.tsx.
import { tabPanelProps, Tabs, LinkTabs } from "@/design-system/components/tabs";Usage
<Tabs
label="Filter projects"
items={[{ id: "all", label: "All", count: 34, icon: <Icon name="layout-dashboard" size={16} color="current" /> }]}
value={tab}
onChange={setTab}
/>Examples
Default
Tabs that switch panels on the same page; idBase and tabPanelProps link each tab to its panel.
With counts
Filter tabs with a count on each; leave out idBase when the tabs filter one list instead of switching panels.
Pill
variant="pill" for switching local views: a soft orange pill slides behind the selected tab.
Pill, neutral
variant="pill-neutral" is the quieter grey version for scope and filter rows.
Loading
loading turns the counts into skeletons and disables the tabs until the numbers arrive.
With an action
action puts a control at the right end of the tab row.
Link tabs
LinkTabs when each tab is its own page; current marks the active one with aria-current. It takes the same variant, icons and counts.
When to use
Use it when
- Switching between views of the same data (All / Active / Completed) with counts
- Sections of a detail page (Overview / Tasks / Files)
- Sibling pages of one area (Finance: Overview / Payments) with LinkTabs
- Switching local views (Board / Timeline) or scopes (All / Mine) with the pill variants
Don’t use it when
- Narrowing a list by one attribute inside a tab → Filter pills
- Picking one of 2–5 settings or periods (Weekly / Monthly) → Segmented control
- Steps that must be done in order → a stepper (not in the system yet)
Rules
- Use LinkTabs when a tab should be linkable or survive reload
- Pass idBase and tabPanelProps() when tabs control panels
- Underline for page sections and filters; pill for local view switchers; pill-neutral for quiet scope rows
- Icons are optional; if one tab has an icon, give them all one
- Counts are plain numbers; 1000 and up show as 1.2k
Properties
Tabs
| Prop | Type | Default |
|---|---|---|
items * | TabItem[] | – |
value * | string | – |
onChange * | (id: string) => void | – |
label * | string | – |
variant | "underline" | "pill" | "pill-neutral" | "underline" |
loading | boolean | false |
action | ReactNode | – |
idBase | string | – |
LinkTabs
| Prop | Type | Default |
|---|---|---|
items * | LinkTabItem[] | – |
current * | string | – |
label * | string | – |
variant | "underline" | "pill" | "pill-neutral" | "underline" |
hrefSuffix | string | "" |
action | ReactNode | – |
* required
Accessibility
- tablist with roving tabindex: arrow keys move and select (wrapping), Home and End jump to the ends (Tabs)
- nav with aria-current="page" on the active link (LinkTabs)
- Icons are hidden from screen readers; the label names the tab
- Reduced motion stops the indicator sliding
Related
Used in the Avesk app: Projects & Clients, Finance & Growth, Design Inspiration, Proposals & Scope.