{"name":"tabs","title":"Tabs","description":"","kind":"component","category":"navigation","status":"beta","props":{"items":{"type":"array","items":{"value":"string","label":"string","content":"string?","disabled":"boolean?","closable":"boolean? (overrides the Tabs' closable)","icon":"icon element or component | image URL (favicon)?"},"description":"Tabs in order, each with its panel content. Strings are accepted as value = label."},"value":{"type":"string","model":true,"description":"Selected tab. Defaults to the first enabled tab."},"variant":{"type":"enum","values":["pill","underline"],"default":"pill","description":"pill: the selected tab sits on a filled pill: the chat header strip, and document tabs (closable: open files, browser tabs). underline: an ink bar under the selected tab on a hairline (the tabs of a panel)."},"size":{"type":"enum","values":["xs","sm","md"],"default":"md","description":"xs 24 · sm 28: dense strips (an editor's file tabs, a browser's tabs), 12px labels, 14px icons; md (default) keeps each variant's height (pill 26, underline 32). Dimensions only."},"inHeader":{"type":"boolean","default":false,"description":"pill or underline, for a strip inside a card header (a code block's file tabs, an editor's panel strip). The list fills the header's height (underline tabs stretch to it) and draws no hairline of its own: the header's bottom line is the line, and the underline rests on it. The panel starts at that line, with no top padding: what it holds (code, a toolbar, a terminal) brings its own inset. Its own prop, not a size: the size scale is dimensions only."},"headerProps":{"type":"object","description":"Attributes for the header row, so a host can mark it as its own part (code-block: data-code-block=\"header\")."},"headerClass":{"type":"string","description":"Wraps the list in the header part with this class added (the host's header row, e.g. a code block's header)."},"closable":{"type":"boolean","default":false,"description":"Every tab gets a close button and closes on Delete (an item's own `closable` wins): document tabs (open files, browser tabs). A closable tab's title is free text: it stops at 240px and is cut at its end, keeping its full text in the title. The Tabs never remove a tab themselves: they select the neighbour and emit close; the caller removes the item. A closable tab added after the first paint opens its room; one closed by the pointer closes it first."},"closeLabel":{"type":"string","default":"Close","description":"Verb of a close button's name, followed by the tab's text (\"Close rate-limit.ts\")."},"labels":{"type":"object","description":"The strings, for translation: allTabs (default \"All tabs\"), the name and tooltip of the button that lists every tab while the strip overflows."},"fill":{"type":"boolean","default":false,"description":"The root takes the height of its container and the selected panel the rest (an editor's bottom panel, a pane). A variant, so hosts never reach into the panel with selectors."},"aria-label":{"type":"string","description":"Name of the tab list."}},"playground":{"name":"Playground","props":{"items":[{"value":"overview","label":"Overview","content":"web-app is live on Production. Last deploy 2 min ago by Maya Chen."},{"value":"deploys","label":"Deploys","content":"24 deploys in the last 7 days, 1 failed on feat/usage-alerts."},{"value":"settings","label":"Settings","content":"Build command, environment variables and domains."}],"value":"overview","variant":"underline","aria-label":"web-app"}},"exampleFiles":[{"file":"project-sections","title":"Sections of a project page"},{"file":"log-source","title":"Switch the log in a card"},{"file":"with-action","title":"An action at the end of the row"},{"file":"plan-locked","title":"A tab not on your plan"},{"file":"open-files","title":"Open files you can close"},{"file":"browser-tabs","title":"Browser tabs with a new-tab button"},{"file":"deploy-panel","title":"Logs that fill their pane"}],"worstCase":[{"name":"Long labels","width":280,"props":{"items":[{"value":"a","label":"Supplier records and every proposed change","content":"A long tab label stays one line; it truncates when the tab is narrower than its text (a max-width from the composing component) and the list scrolls sideways."},{"value":"b","label":"A","content":"One letter."},{"value":"c","label":"maximilian.wisniewska-kowalczyk@example.com","content":"An unbreakable label."}],"value":"a","aria-label":"Worst case"}},{"name":"Many tabs","width":300,"props":{"items":["Mon","Tue","Wed","Thu","Fri","Sat","Sun","Every weekday","Custom"],"value":"Wed","variant":"underline","aria-label":"Days"}},{"name":"Right to left","props":{"items":[{"value":"chat","label":"محادثة","content":"اسأل عن آخر ثلاثة طلبات."},{"value":"notes","label":"ملاحظات","content":"ملاحظتان من التذوق."}],"value":"chat","aria-label":"اللوحة"}},{"name":"One tab","props":{"items":[{"value":"all","label":"All","content":"A single tab still reads as a tab strip."}],"value":"all","aria-label":"Single"}},{"name":"Closable, long and many","width":260,"props":{"closable":true,"items":[{"value":"a","label":"maximilian.wisniewska-kowalczyk@example.com","content":"An unbreakable label."},{"value":"b","label":"A","content":"One letter."},{"value":"c","label":"billing-api / src / webhooks / deliver.ts","content":"A path."},{"value":"d","label":"ملاحظات","content":"Right to left text."},{"value":"e","label":"package.json","content":"Last tab."}],"value":"e","aria-label":"Open files"}},{"name":"Document tabs, many files","props":{"size":"xs","closable":true,"style":{"width":300},"items":[{"value":"rate-limit.ts","label":"rate-limit.ts","content":"rate-limit.ts"},{"value":"src/middleware/a-very-long-file-name-for-the-webhook-delivery-retry-policy.ts","label":"src/middleware/a-very-long-file-name-for-the-webhook-delivery-retry-policy.ts","content":"src/middleware/a-very-long-file-name-for-the-webhook-delivery-retry-policy.ts"},{"value":"index.ts","label":"index.ts","content":"index.ts"},{"value":"x.ts","label":"x.ts","content":"x.ts"},{"value":"README.md","label":"README.md","content":"README.md"},{"value":"package.json","label":"package.json","content":"package.json"}],"value":"index.ts","aria-label":"Open files"}}],"anatomy":[{"part":"root","element":"div","description":"data-orientation (set by the engine). A grid: without the header part, the list and the all-tabs menu share the first row; every other part spans both columns. Rows are as tall as their content, packed at the top, so a panel keeps its content's height in a taller root. With fill: the height of its container (which must have one), and the selected panel's row takes what the strip leaves."},{"part":"header","element":"div","optional":true,"description":"Optional. The host's header row around the list (headerClass adds the host's class), holding the all-tabs menu (while the strip overflows) and then the host's trailing parts (the end slot). Rendered only when headerClass or end is given. A flex row; with inHeader the list fills its height."},{"part":"list","element":"div","description":"role=tablist; the indicator's offset parent. Scrolls sideways when the tabs do not fit (no scrollbar, the wheel's sideways overscroll stays in): the selected tab is kept in view, 24px clear of the edge so the next one peeks in. data-overflow while the tabs are wider than it (measured on mount and on every change of size or of the tabs; never on a list with no box, display: none on it or above it). data-overflow-start / data-overflow-end while tabs are hidden past that edge (the scroll position, logical): each such edge fades out over 24px (a mask; underline keeps its hairline whole)."},{"part":"indicator","element":"div","description":"The engine's indicator: given the selected tab's box as --left / --top / --width / --height, it travels on transform only while a pointer selection is made; hidden until measured. Pill: field colour, radius.chip. Carries kbd-instant."},{"part":"tab","element":"div","optional":true,"repeat":true,"description":"Only around a closable tab: the trigger and its close button side by side (a button cannot hold a button). Not positioned, so the trigger's offset box stays the list's (the indicator measures the trigger, which keeps room at its end for the close button, so the pill or the underline spans both). It is the tab's room: it opens and closes (see motion, arrival and closing)."},{"part":"trigger","element":"button","repeat":true,"description":"role=tab; aria-selected, data-selected, data-disabled. Holds the label part."},{"part":"icon","element":"span","optional":true,"description":"An item's icon before its label: a file icon (an icon element / component, data-slot=\"icon\") or a favicon (an image URL, drawn as an <img alt=\"\">). aria-hidden: the label names the tab. 16px (14px at xs and sm)."},{"part":"label","element":"span","description":"The tab's text on one line; it truncates at the end and carries the full text as title. A view's name (a tab that is not closable) is never cut by the Tabs themselves: it is cut only when the strip is narrower than the one tab. A closable tab's title is free text (a document's name) and stops at 240px, cut at its end."},{"part":"close","element":"button","optional":true,"repeat":true,"description":"A closable tab's close button: 16px with a 24px target, pulled back over the trigger's end room. Shown on the selected tab and while its tab is hovered (always on touch); keeps its room at rest, so the strip never reflows. Not a tab stop (the keyboard closes with Delete on the tab, aria-keyshortcuts) but not hidden either: named \"Close <tab>\", reachable by a screen reader's cursor and by touch exploration. A press never takes focus."},{"part":"more","element":"div","optional":true,"description":"The all-tabs menu: the Menu's root, after the list and before the end slot, marked data-tabs=\"more\". Rendered only while the list has data-overflow. Its items are one radio group of every tab in order (a tab whose label is not text is listed by its value), the selected tab checked and disabled tabs disabled; picking one selects that tab (valueChange), closes the menu and focuses the tab, and the strip scrolls it into view. Placed bottom-end."},{"part":"more-trigger","element":"button","optional":true,"description":"The menu's trigger: the real Button (ghost, muted, square, caret-down), marked data-tabs=\"more-trigger\", named and tooltipped by labels.allTabs. Its size matches the strip: xs for pill (held to the strip's height by negative block margins at xs and sm), the Tabs' size for underline. Underline outside a header: the hairline runs on under it."},{"part":"content","element":"div","repeat":true,"description":"role=tabpanel; hidden unless its tab is selected. With fill: takes the height the strip leaves and scrolls inside itself (put a ScrollArea with h-full in it for the system's scrollbar)."}],"slots":{"panel":"Content of a panel (Vue slot / Svelte snippet, called with the item). In React an item's `content` may be a node.","end":"Parts after the list inside the header part (a path, a copy button); implies the header part."},"events":{"valueChange":"(value: string)","close":"(value: string) when a closable tab asks to close (its button, or Delete / Backspace on it). If it was selected, valueChange has already moved the selection to the next enabled tab, else the previous. Closed by the pointer: emitted once the tab's room has closed (duration.reveal later); from the keyboard and under reduced motion at once."},"states":["selected","hover","press","focus-visible","disabled","closable","close-hover","close-press","fill","overflow"],"tokens":["color.field","color.ink","color.ink-2","color.ink-3","color.line","text.sm","duration.press","duration.move","easing.move","easing.out-strong","motion.press-scale","duration.base","radius.chip","color.accent","color.hover","duration.fast","text.xs","duration.reveal"],"a11y":{"role":"tablist + tab + tabpanel","keyboard":["Tab reaches the selected tab; the list is one tab stop, the next Tab goes to the panel","ArrowRight / ArrowLeft move to the next / previous enabled tab and select it (selection follows focus); they wrap","Home / End move to the first / last enabled tab and select it","Delete (and Backspace, the key macOS labels delete) closes the focused closable tab; focus and selection move to the next enabled tab, else the previous. The browser keeps Ctrl/⌘ W, so the platform's own close shortcut cannot be taken by a web page","While the strip overflows, the all-tabs button is the next Tab stop after the list: Enter, Space or ArrowDown open its menu (the Menu's keys); Enter on a tab selects it, closes the menu and moves focus to that tab, where the arrow keys and Delete work as after any selection"],"notes":["Give the list an aria-label when nothing else names it.","A selection made from the keyboard moves the indicator instantly; the slide is for the pointer. Panels never animate.","A truncated label keeps its full text in the title; the accessible name is the full text either way.","To select from outside, control `value`: React value / onValueChange, Vue v-model:value, Svelte bind:value.","A closable trigger carries aria-keyshortcuts=\"Delete\"; its close button is not a tab stop (the Tab key meets only tabs) but it is not hidden: it is named \"Close <tab>\" (closeLabel + the tab's text), so a screen reader's cursor and touch exploration (VoiceOver, TalkBack) reach and press it; Delete keeps working on the focused tab.","When the selected tab moves out of a scrolling strip it is scrolled back into view: instantly after a key, smoothly after a click.","An item's icon is decoration (aria-hidden; a favicon is an <img alt=\"\">): the label is the tab's name.","The all-tabs button appears only while some tabs are out of view; it is named (labels.allTabs) and shows the same name as a tooltip. Its menu is a radio group, so the selected tab is announced as checked."]},"motion":["indicator: transform and width over duration.move with easing.move, only for a pointer selection; no slide on mount, none on resize, instant under the keyboard; on the selected tab from the first paint (the adapters place it before the engine measures; until then the selected tab paints the same pill itself and hands over at once)","tab label: colour over duration.base, ease: ink-2 at rest, ink on hover, ink when selected (both variants; no opacity); instant under the keyboard","press: the tab scales to motion.press-scale over duration.press","panel: swaps instantly","close button: fades in on hover of its tab (opacity over duration.fast); background over duration.fast; press scales to motion.press-scale from the pointer only","strip scroll: smooth to the selected tab after a pointer selection, instant after a key or under reduced motion","closing: from the keyboard, instant (the tab goes, its neighbours close the gap in one frame, the indicator lands on the neighbour). From the pointer, the tab's room closes (width, min-width and inline padding to 0, and underline's gap after it, over duration.reveal, easing.out-strong) while it fades (opacity over duration.base) and takes no presses; close is emitted when the room has closed (duration.reveal later; at once under reduced motion). The selection and focus move to the neighbour at once","arrival (closable tabs): a tab added after the first paint opens its room from 0 (width, min-width, inline padding, and underline's gap after it, over duration.reveal, easing.out-strong) while it fades in over duration.base, so the tabs after it and the parts after the strip move instead of jumping; the indicator measures the trigger and lands on the selected tab; nothing plays on the first paint (the adapters set ready two frames after mount); instant when the keyboard was last used; under reduced motion only the fade. The width is auto and moves through interpolate-size: in browsers without it the tab appears at once","edge fades: none of their own; the mask follows the scroll position at once (no transition), and the all-tabs button appears and goes without motion when the strip starts or stops overflowing"]}