File Tabs
Paper-style folder tabs over a package of static documents kept together, like tabbed dividers in a binder: a grant application, a plot lease, a year of meeting minutes. Each tab is a standalone document; they share one panel, with optional controls and a busy status at the header's end.
For code files, use Code Block or Demo: they render their headers with File Tabs.
import {
FileTabs,
FileTabsControl,
FileTabsList,
FileTabsPanel,
} from '@fairgarden/design/navigation/file-tabs'
FileTabs holds the selection and the header's settings (frame, controls, status, mono). FileTabsList renders the header from them: 56 px with its rule, the tabs across its whole width under 12 px of room and standing on the rule, and the status and controls at its end. FileTabsPanel is the one tabpanel, labelled by the selected tab. The tabs are paper: the selected tab takes the panel's own face and opens into it, with no rule between them, and its label turns bold; the others sit recessed behind it on a slightly darker step of the same scale, each standing on the header's rule. The state reads by weight and by the joined edge, not by color alone. The selected tab's radii grow while it's pressed; each label reserves its bold width, so selecting a tab never moves the row. Hover underlines the other labels. Labels take the UI face at the caption size and are never caps; mono sets them in mono for file names, as Code Block and Demo do. It needs no docs engine, so it works anywhere.
The header is one fixed row that never wraps, so nothing that joins it later can move the page. The header opens a host: a bordered box with no padding, a --primary1 face and no clip, such as a code block's frame, or the FileTabs root given a frame class, as in these demos. The host keeps the page's panel radius, --radius-2-25; the tabs alone take the paper-tab radius, --radius-2-75, and their curves leave the host's side line below its corner. The tab strip runs out over the host's side edges by their width, so there's no gap between an end tab and the edge, and the edges are drawn again over the header, so scrolled tabs and the ends of the strip's scrollbar pass under them. frame says which host it is: "top" (the default) for the top of a box with rounded corners, "joined" for a part below another, and "none" for no box at all.
In print the header hugs its labels: plain labels in a wrapping row, the selected one in bold, without the controls or status.
Tabs or File Tabs?
Tabs switch between views or sections of one thing on a page: settings panes, the sections of an article, filtered views of one list. File Tabs hold a package of separate documents kept together, where each tab is a standalone document, drawn as paper tabs. For code files, use Code Block or Demo, which use File Tabs for their headers.
Documents
Documents
With two or more documents the header shows tabs; with one it shows the document's title as a label, and the panel is a plain region. Arrow keys move between tabs and Enter or Space selects, so moving focus never swaps the document.
Plot lease, 2026 season
Plot 14 at Riverbend Community Garden is leased to its gardener from March 1 to November 30. The lease renews each winter while the plot is kept planted and tidy.
Signed at the February open day.
Welcome to Riverbend! Your key to the tool shed is on the hook inside the gate box, and the next work day is the first Saturday of April.
Deep links
Deep links
A tab with a slug is a link to #slug. A plain click selects the document without writing the hash or jumping the page; a modifier click (Ctrl, Cmd, Alt or Shift, from the keyboard too) opens the link elsewhere and leaves the selection alone. The scroll targets and the hash latch belong to the consumer, as this demo renders them.
Cover letter
Riverbend Community Garden asks the county’s neighbourhood fund for help building a rain-fed watering system for its forty plots.
Link to the budget or the letters of support.
Agenda with attachments
Agenda with attachments
A cover document and its attachments in one frame: the meeting's agenda, or its minutes, above, and the documents it refers to below in frame="joined" tabs. A link in the cover selects that document's tab through the controlled value and moves focus to the tab, as the tabs pattern does, scrolling it into view; a modifier click still opens the link, and the hash selects the document on load.
Garden committee, March meeting
Tuesday 10 March, 7 pm, in the Riverbend tool shed
- Welcome and apologies
- Treasurer's report
- Plot waitlist: two plots to offer
- Tool shed quote
- Spring planting plan
- Any other business
Treasurer's report
The garden holds $1,240 after the seed sale. Water and insurance are paid through June.
Controls
Controls
controls go at the header's end. A FileTabsControl is the one to use for a menu: render it as the Menu's trigger (<Menu.Trigger render={<FileTabsControl />}> from Base UI) with an Icon inside (the ⋮ is more_vert at the tag tier, size="tag") and an aria-label. It always hangs just outside the host's end edge, whatever the number of documents, and takes no room from the tabs: an ear 20 px wide from the frame's line, from its top edge to the foot of the header's rule. Its 44 px hit area reaches out into the gutter, never over the tabs. Pointing at it or focusing it outlines the ear at once, on a soft fill; its tooltip keeps its own delay. At the top of a rounded frame the outline wraps the frame's corner: it runs along the frame's arc and end edge, so ear and corner read as one shape. A document menu holds actions such as print, download and copy link; a copy confirms with a Toast, never in the header. A FileTabsControl can also be a lone action, named by its aria-label and a Tooltip, as a nameless snippet's copy button is in Code Block. With no documents at all there's no header row: the control hangs from the frame's top-end corner. Small icon Buttons, the other kind of control, sit in the header instead, beside a single document's label.
Leave room for it. Nothing measures the space: the host must leave --fgd-size-file-tabs-control (24 px) free past the frame's end, with nothing clipping it sideways, or an overflow-clip-margin that covers it. Where the page ends sooner than the 44 px hit area, clip the page sideways (overflow-x: clip) so the rest of it can't scroll the page. This site's column keeps that gutter at every width, 44 px from the medium breakpoint. Both columns below keep it: the first on the page, the second inside a column that clips, with the gutter inside its clip.
Take up to five seed packets a season; return a packet of saved seed if you can.
Take up to five seed packets a season; return a packet of saved seed if you can.
Many documents
Many documents
Any number of documents fits. When the tabs overflow, the row scrolls sideways with the browser's own scrollbar. The header keeps its height whatever the scrollbar takes: a scrollbar that takes room hangs flush under the header's rule, over the panel's top, and one that overlays the page shows over the foot of the tabs. Either way the tabs never lift off the rule. At either end of the scroll the end tab sits flush with the frame's edge.
March meeting minutes
Twelve gardeners attended. The committee reviewed the work-day schedule, the plot waitlist and the treasurer’s report, and set the next meeting for the second Tuesday.
One document
One document
With one document, the label and the controls share the header: a row of small icon Buttons, each named by a Tooltip. Use text icon-only Buttons: they're quiet at rest, a glyph with no edge, like the ⋮, and pointing at one or focusing it draws its circle at once. They never hang, and the header never wraps: the label truncates with an ellipsis to leave them room. The row is aligned to the end, so a control that joins later goes first in controls and the ones already there stay put. A confirmation, such as a copied link, is a Toast in the page's toast bar, never text in the header or a changed icon.
Sign in at the shed whistle board, wear closed shoes, and ask a crew lead before using the chipper. Work days run 9 to noon; water and gloves are provided.
Status
Status
status is the busy "-ing…" label while something the header started is under way, such as "Saving…". It's laid over the header's end beside the controls, covering the end of the tabs on the frame's face rather than pushing them, so they never move. It's a live region, mounted whenever status is set: pass '' while idle rather than leaving it out, so the change is announced. Confirmations don't go here: a copied link, say, shows a toast.
Saturday crew
Nine volunteers mulched the orchard path and turned two compost bays.
Frames
Frames
frame="joined" puts the header in a part of the host below another, as the Agenda demo's attachments sit under its agenda, and a demo's code under its preview: the header draws the rule that joins them, and the side edges run from it. frame="none" is for tabs with no box around them: the strip stays inside the header, the end tabs show their own edges, and a FileTabsControl hangs past the header's own end.
2026 harvest: 68 kg from fourteen plots, 52 kg to the food bank.
Tomatoes 38 kg, squash 21 kg, beans 9 kg, from fourteen plots.
Tomatoes 38 kg, squash 21 kg, beans 9 kg, from fourteen plots.
Disabled
Disabled
disabled holds every tab while the documents load: muted labels with a dotted underline, never dimmed. The selected tab keeps its face, shape and weight, so its muted label still reads. A disabled FileTabsControl stands in for the menu until it loads, in the same place and size.
Loading…
Mono labels
mono sets the labels, and a single document's label, in mono (type-data) for file names, e.g. code. Code Block and Demo set it; the geometry is the same in either face.
API Reference
FileTabs
The root of a set of file tabs: it holds the selection and the header’s
frame, controls, status and mono, and wraps both the header
(FileTabsList) and FileTabsPanel. Tabs with a slug are deep links:
a plain click selects the document, a modifier click opens the link and
leaves the selection.
| Prop | Type | Description |
|---|---|---|
defaultValue | | Uncontrolled initial |
value | | Controlled: the selected tab’s |
onValueChange | | Called on user selection only. Not called for a modifier activation, which
|
controls | | Controls at the header’s end: a
|
frame | | Where the header sits. Its host is the bordered box it opens: a
|
mono | | Labels in mono ( |
primary | | Primary scale: labels, rules, the tabs’ faces (the recessed --primary3, the front --primary1), focus ring. Never defaulted [D133]. |
secondary | | Secondary scale: the hover underline ( |
status | | The busy “-ing…” label while something the header started is under way
(“Switching to JS…", “Formatting…") [D84], laid over the header’s end
beside the controls: mono, |
tabs | | |
disabled | | Disables every tab: |
FileTabsList
The header: one fixed 56 px row with its --role-rule, the folder tabs
across its full width under 12 px of room, standing on the rule, and the
Root’s status and controls at its end. The labels take the UI face
(mono with mono); the selected tab takes its panel’s face and opens
into it, the others recessed behind it with its neighbours tucked
under it. When they overflow, their row scrolls sideways with its native
scrollbar, which hangs just below the header (or overlays the strip’s
foot, where scrollbars overlay), so the tabs never lift off the rule.
With one tab it shows that name as a label (no tablist), truncated with
an ellipsis where the controls need its room; with none, the controls
and status (a FileTabsControl alone hangs, with no header row), or
nothing. Its own props (aria-label, className …) go to the tablist,
or to the one document’s label.
| Prop | Type | Description |
|---|---|---|
aria-label | | The tablist’s accessible name. Default |
FileTabsControl
One header control for the Root’s controls: a <button> holding an
icon (an Icon with weight="interactive" takes its hover weight here;
the ⋮ is more_vert at the tag tier, size="tag", 20 px).
It always hangs outside the host’s inline-end edge: an ear --size-px-4
wide from the host’s edge line, from the host’s top edge to the header
rule’s foot, with its --fgd-size-hit hit area past that edge and none
over the tabs; the host leaves --fgd-size-file-tabs-control free there.
Hovered or focused, the ear shows at once, drawn in --primary12 on the
--role-soft-hover fill (at the top of a rounded host, wrapping the
host’s top-end corner, so the outline runs unbroken round both); while its popup is open (aria-expanded="true";
a tooltip’s data-popup-open changes nothing), on the --primary1 face.
As a Menu’s trigger:
<Menu.Trigger render={<FileTabsControl />} aria-label="More actions">.
Or as a lone action, where it is the only one (Code Block’s nameless
snippet hangs its copy, content_copy at the tag tier): name it with
aria-label, pair it with a Tooltip, and give it an onClick.
| Prop | Type | Description |
|---|---|---|
className | |
FileTabsPanel
The panel for the selected tab: role="tabpanel", labelled by the selected
tab, which aria-controls it. Its element stays the same across selections,
so the content inside is never remounted; empty hidden panels stand in for
the other tabs, so every tab’s aria-controls resolves. With fewer than
two tabs it renders a plain div (there is no tablist to pair with).
Additional types
FileTab
One tab: a document in the package.
type FileTab = {
/** The tab's value, unique within `tabs`. A code block passes the file name. */
id: string;
/** The label: the document's short title (a file name in a code block). UI face at the caption size, not caps; mono with `mono`. */
name: string;
/**
* Deep-link slug. The tab renders as `<a href="#slug">` (`nativeButton={false}`).
* A plain click selects the tab and `preventDefault()`s the anchor, so the page
* doesn't jump and the hash isn't written. A modifier click (Ctrl, Cmd, Alt or
* Shift) opens the link and leaves the selection alone.
*/
slug?: string;
}FileTabsControlProps
Props for FileTabsControl: button props plus render. Name it with aria-label.
type FileTabsControlProps = { className?: string }FileTabsFrame
Where the header sits on its host: see FileTabsProps['frame'].
type FileTabsFrame = 'top' | 'joined' | 'none'FileTabsListProps
Props for FileTabsList: Base UI Tabs List props; the tabs, controls and status come from the Root.
type FileTabsListProps = {
/** The tablist's accessible name. Default `"Documents"` (Code Block passes `"Files"`). */
'aria-label'?: string;
}FileTabsPanelProps
Props for FileTabsPanel: Base UI Tabs Panel props; its value is the selected tab’s.
type FileTabsPanelProps = Omit<TabsPanel.TabsPanelProps, 'value'>FileTabsProps
Props for FileTabs: Base UI Tabs Root props (without its value props and orientation) plus the documents, the header’s frame, controls, status and label face, and the color axes.
type FileTabsProps = {
tabs: FileTab[];
/** Controlled: the selected tab's `id`. `undefined`, or an id not in `tabs`, selects the first tab. */
value?: string;
/** Uncontrolled initial `id`. Default: the first tab. */
defaultValue?: string;
/**
* Called on user selection only. Not called for a modifier activation, which
* `eventDetails.cancel()`s. The modifiers are read from `eventDetails.event`
* (Base UI 1.8), so this covers the keyboard as well as the pointer.
*/
onValueChange?: (id: string) => void;
/** Disables every tab: `--role-muted` label plus a `line-dotted-fine` underline, no opacity. Default `false`. */
disabled?: boolean;
/**
* Labels in mono (`type-data`, §3.11) instead of the UI face: for file
* names, e.g. code. Mono labels are left to right (`dir="ltr"`) on any
* page, since file names are, while the tabs and header still mirror in
* RTL. Code Block and Demo set it. Default `false`.
*/
mono?: boolean;
/**
* Where the header sits. Its host is the bordered box it opens: a
* `--border-size-1` edge, no padding, a `--primary1` face and no clip,
* such as Code Block's frame, or the Root itself given a frame class.
* `'top'`: at the top of the host, whose top corners take
* `--radius-2-25` (a host with another radius sets `--file-tabs-host-radius`
* on the Root). The tab strip runs out over the host's side edges by
* their width, so an end tab's edge is the host's edge, its paper-tab
* corner leaving that line below the host's corner; the side edges are
* drawn again over the header from below the host's corner radius, so
* scrolled tabs and the ends of the strip's native scrollbar pass under
* them; a `FileTabsControl` hangs outside.
* `'joined'`: the same, in a part of the host below another (Demo's
* code); the header draws the `--role-rule` that joins the part above,
* and the side edges run from it. `'none'`: no host frame (tabs over
* their panel on the page); the strip stays inside the header, the end
* tabs show their own edges, and a `FileTabsControl` hangs past the
* header's own end. Default `'top'`.
*/
frame?: FileTabsFrame;
/**
* Controls at the header's end: a `FileTabsControl` (a Menu's ⋮ trigger)
* or a few small icon Buttons.
* - A `FileTabsControl` always hangs just outside the host's inline-end
* edge (past the header's own end with `frame="none"`) with zero layout
* width, whatever the tab count, so the tabs keep the whole header. Its
* hit area, `--fgd-size-hit`, extends outward into the gutter, never
* over the tabs. **The host must leave `--fgd-size-file-tabs-control`
* (24 px) free past its edge, unclipped** (or inside an
* `overflow-clip-margin`); where the page ends sooner, clip it sideways
* (`overflow-x: clip`) so the rest of the hit area can't scroll it.
* With no document (`tabs` empty) there is no header row at all: the ⋮
* hangs from the host's top-end corner.
* - Small icon Buttons (`variant="text"` icon-only `sm` Buttons) sit in
* the header, quiet at rest: their edge is drawn only while pointed at
* or focused. They sit beside the one document's label, which truncates
* to leave them room (the header never wraps); with several documents,
* in a `--fgd-size-hit` cell at the header's end with a `--role-rule`
* start edge, where the tabs end. The row is end-aligned: a control
* that joins after the first paint goes before the others (earlier in
* `controls`), so the ones already painted don't move.
* Hidden in print.
*/
controls?: React.ReactNode;
/**
* The busy "-ing…" label while something the header started is under way
* ("Switching to JS…", "Formatting…") [D84], laid over the header's end
* beside the controls: mono, `--role-muted`, on the `--primary1` face with
* a `--role-rule` start edge, so it never moves or narrows the tabs. Its
* element is a `role="status"` live region, rendered whenever `status`
* isn't `undefined`: pass `''` while idle, so it stays mounted and its
* changes are announced. Not for confirmations such as a copy: those are
* toasts (§10.17). Hidden in print.
*/
status?: React.ReactNode;
/** Primary scale: labels, rules, the tabs' faces (the recessed --primary3, the front --primary1), focus ring. Never defaulted [D133]. */
primary?:
| 'ruby'
| 'olive'
| 'sage'
| 'slate'
| 'sand'
| 'gray'
| 'mauve'
| 'brown'
| 'bronze'
| 'gold'
| 'red'
| 'crimson'
| 'tomato'
| 'pink'
| 'plum'
| 'indigo'
| 'iris'
| 'violet'
| 'purple';
/** Secondary scale: the hover underline (`--role-accent`). Never defaulted. */
secondary?:
| 'ruby'
| 'olive'
| 'sage'
| 'slate'
| 'sand'
| 'gray'
| 'mauve'
| 'brown'
| 'bronze'
| 'gold'
| 'red'
| 'crimson'
| 'tomato'
| 'pink'
| 'plum'
| 'indigo'
| 'iris'
| 'violet'
| 'purple'
| 'amber'
| 'blue'
| 'cyan'
| 'grass'
| 'green'
| 'jade'
| 'lime'
| 'mint'
| 'orange'
| 'sky'
| 'teal'
| 'yellow';
}Specification: DESIGN-SYSTEM.md §9.13 (file tabs), §9.5 (tabs) and §3.11 (mono for file names).