Tabs
Terminal-styled tabbed interface with horizontal and vertical orientation support.
Installation
dgadd is not public on npm yet. Until the first release, pack @diffgazer/add from the repository and install that tarball into this app, which is what puts dgadd on pnpm exec.
The hosted registry is not public yet because r.b4r7.dev does not resolve. Use this source checkout or a local registry preview until the endpoint returns 200.
Diffgazer packages are not yet published to npm. Until the first release, pack @diffgazer/ui and @diffgazer/keys from the repository and install those tarballs.
UI components require Tailwind CSS v4. Local copy mode imports src/styles/styles.css; package mode uses @diffgazer/ui CSS once packages are available.
Usage
Examples
Trigger Variants
Vertical Orientation
Controlled with Disabled Tab
Keyboard Navigation
Wrapped Reflow
API Reference
Tabs
Tabs.List
Tabs.Trigger
Tabs.Content
Data attributes
Accessibility
Keyboard Navigation
TabsList has built-in keyboard navigation via @diffgazer/keys. ArrowLeft/ArrowRight (horizontal) or ArrowUp/ArrowDown (vertical) navigate between tabs. Home/End jump to first/last tab. Enter/Space activate the focused tab. With loop disabled, arrow navigation stops at the edges and fires onNavigationBoundaryReached for composite focus handoff.
| Key | Action |
|---|---|
| ArrowLeft / ArrowRight | Moves focus across horizontal tab triggers. |
| ArrowUp / ArrowDown | Moves focus across vertical tab triggers. |
| Home / End | Moves focus to the first or last enabled trigger. |
| Enter / Space | Activates the focused tab in manual mode. |
Keyboard Navigation
Notes
Requires @diffgazer/keys (package mode)
TabsList's arrow-key navigation imports from the required @diffgazer/keys peer. Package consumers must install @diffgazer/keys with @diffgazer/ui; packages are not yet published to npm, so until the first release install both from locally packed tarballs. Importing @diffgazer/ui/components/tabs without keys fails at module load with an error naming the missing @diffgazer/keys package. Copy/dgadd consumers do not need the package — copy mode rewrites the keyboard hooks to local source.
Composition Contract
Use Tabs.List, Tabs.Trigger, and Tabs.Content as explicit children in the Tabs JSX tree. Custom tab visuals belong inside Tabs.Trigger. Components that create triggers internally from an opaque wrapper are not part of the current public contract.
Orientation Support
Tabs default to horizontal orientation. Set orientation='vertical' to stack triggers vertically. Keyboard arrow directions automatically align with the orientation.
Horizontal reflow
Horizontal Tabs.List wraps triggers and label text by default so constrained layouts do not create page-level horizontal scrolling. Pill and underline variants use a selected treatment on each trigger when rows wrap. Set wrap={false} only when a single-row layout is guaranteed.
Panel ownership
Tabs.Content owns its DOM id and hidden state so the matching trigger's aria-controls reference and inactive-panel visibility stay synchronized. Pair triggers and panels with value instead of overriding id or hidden.
Tab list semantics
Tabs.List owns its tablist role, orientation, variant, and wrapping state. Native attributes can label or describe the list but cannot replace those compound-component invariants.
Source
Install via CLI: pnpm exec dgadd add ui/tabs. Keyboard hooks are included as standalone copies. For the full experience, use --integration keys.
Highlighted source loads after this disclosure opens. Browse the source repository.