hp-sidebar
Navigation sidebar chrome. Compose with <hp-sidebar-item> leaves and
<hp-sidebar-group> collapsible sections. Each child element owns its
own visual identity inside its shadow root — the sidebar itself only provides the
sticky padding, border, scroll, and inherited typography.
Install
bun add @hexpunk/core lit import "@hexpunk/core"; Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
variant | variant | HpSidebarVariant | "primary" | Visual variant. - `"primary"` (default): full chrome with a right border. Intended as the page's main nav rail on the left. - `"secondary"`: lighter chrome, no right border. Intended for a right-rail table-of-contents or similar companion list. |
Slots
| Slot | Description |
|---|---|
(default) | Nav tree (hp-sidebar-item + hp-sidebar-group children) |
When to use
<hp-sidebar-item>
and <hp-sidebar-group> children — no ad-hoc
<ul> / <details> markup needed.
active on the matching
hp-sidebar-item, and pre-open the ancestor groups by setting
open on each so the active item is visible without a click.
hp-sidebar instances side by side. The component carries
its own border + padding — adjacent instances read as duplicated chrome.
Nesting and visual hierarchy
Groups directly inside hp-sidebar render with the body-sm summary
style (e.g. "Getting Started", "Components"). Groups nested inside another group
switch to an uppercase label-sm summary so a long nav tree doesn't read as a wall
of equally-weighted branches. The switch is automatic via
:host-context() — no variant attribute to set.
Accessibility
hp-sidebar auto-stamps role="navigation" on its host. Set
aria-label on the host for a labelled landmark; screen readers
announce the sidebar by that label. hp-sidebar-group uses native
<details> / <summary> internally, so
disclosure semantics + keyboard handling come from the platform.
No per-component entries in CHANGELOG.md yet.