Navigation List
Terminal-styled navigation sidebar list with selection, keyboard navigation, and composable item parts.
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
Density Variants
Controlled Selection
Progress Bars
Section Groups
Tree View
Indicator Variants
API Reference
NavigationList
NavigationList.Item
NavigationList.Title
NavigationList.Status
NavigationList.Meta
NavigationList.Subtitle
NavigationList.Badge
NavigationList.Group
NavigationList.Progress
Data attributes
Accessibility
Keyboard Navigation
Arrow keys and their vim aliases j/k navigate between items with wrapping. Enter activates the highlighted item. Home and End jump to the first and last items.
| Key | Action |
|---|---|
| ArrowUp / k | Moves highlight to the previous enabled item. |
| ArrowDown / j | Moves highlight to the next enabled item. |
| Home / End | Moves highlight to the first or last enabled item. |
| Enter | Activates the highlighted item via onEnter or onSelect. |
| ArrowRight | Expands the highlighted group header when it is collapsed. |
| ArrowLeft | Collapses the highlighted group header when it is expanded. |
| Enter / Space | Toggles the highlighted group header. |
| Boundary ArrowUp / ArrowDown / k / j | Calls onNavigationBoundaryReached with the pressed key when wrap is false and focus attempts to leave the list. |
External @diffgazer/keys navigation
Notes
Current-location mark
The library spells "you are here" one way: a 2px left rail in --primary (registry/lib/marker-rail.ts). Full-bleed inversion is reserved for the TRANSIENT keyboard highlight; a row that is both the current location and the highlight keeps the inversion and flips its rail to --primary-foreground so the mark survives. The rail is reserved transparently in the resting state and pulled back by its own width, so a row's label never shifts horizontally when it becomes current — that anti-shift geometry is the contract, and it is why the rail costs 0px of label width at 375/390 where a full-bleed fill reads as a solid slab. NavigationList therefore draws a rail on the selected row instead of relying on the full-bleed fill alone, and the inner indicator no longer halves its opacity in `bar` mode.
Composition Contract
Use NavigationList.Item and its static parts as explicit children in the NavigationList JSX tree. Custom item UI belongs inside NavigationList.Item. Components that create items internally from an opaque wrapper are not part of the current public contract.
Density
density prop controls item padding — compact (6px), default (12px), or comfortable (20px).
Rich Items
NavigationList.Item supports compound parts: NavigationList.Title, NavigationList.Meta, NavigationList.Badge, NavigationList.Subtitle, and NavigationList.Status.
Built-in Keyboard API
NavigationList includes arrow-key navigation with the vim aliases j/k and exposes highlighted, onHighlightChange, onEnter, onNavigationBoundaryReached, autoFocus, focused, and onKeyDown for controlled highlight state or extra app-level shortcuts.
Group Expand/Collapse
Group headers participate in list navigation. ArrowRight expands a collapsed group, ArrowLeft collapses an expanded group, and Enter or Space toggles the highlighted group.
Source
Install via CLI: pnpm exec dgadd add ui/navigation-list. 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.