Skip to content

HySidebarGroup

Usage examples on this page are written for Lit / plain HTML (<hy-sidebar-group>). The same component ships as HySidebarGroup in @whitespaceux/harmony-react (native React 19), with typed wrappers for Angular, Solid, Svelte, and Vue. The API reference below applies to all frameworks.

A titled section inside hy-sidebar. Gives nav items a labeled boundary (role="group" + aria-labelledby) without any visual chrome beyond a caption.

With collapsible, the caption becomes a button that toggles a local expanded/collapsed state for the group. Independent from the parent sidebar's collapsed state — when the parent is collapsed, the caption hides visually, but the accessible name remains.

Examples

Titled section inside a sidebar

html
<hy-sidebar-group label="Workspace">
  <hy-sidebar-item value="dashboard" href="/dashboard" active>Dashboard</hy-sidebar-item>
  <hy-sidebar-item value="projects" href="/projects">Projects</hy-sidebar-item>
</hy-sidebar-group>

Collapsible group

javascript
<hy-sidebar-group label="Advanced" collapsible>
<hy-sidebar-item value="tokens" href="/tokens">Tokens</hy-sidebar-item>
<hy-sidebar-item value="audit" href="/audit">Audit</hy-sidebar-item>
</hy-sidebar-group>
<script>
document.querySelector('hy-sidebar-group').addEventListener('toggle', (e) => {
console.log(e.detail.expanded);
});
</script>

API

Properties

PropertyAttributeTypeDefaultDescription
labellabelstring''Caption text displayed above the items.
collapsiblecollapsiblebooleanfalseWhether the caption toggles expand/collapse for this group.
expandedexpandedbooleantrueExpanded state. Only meaningful when collapsible.

Events

EventDetailDescription
toggleOnly when collapsible. Detail: { expanded: boolean }

Slots

SlotDescription
defaultItems to group.

CSS Parts

PartDescription
baseThe <section> wrapper.
captionThe caption element (heading or button).
itemsThe items region.

CSS Custom Properties

PropertyDescription
--hy-sidebar-group-caption-padding-blockCaption block padding
--hy-sidebar-group-caption-padding-inlineCaption inline padding
--hy-sidebar-group-caption-colorCaption text color
--hy-sidebar-group-caption-font-familyCaption font family
--hy-sidebar-group-caption-font-sizeCaption font size (default: --hy-label-sm-font-size)
--hy-sidebar-group-caption-font-weightCaption font weight (default: --hy-label-sm-font-weight)
--hy-sidebar-group-caption-line-heightCaption line height
--hy-sidebar-group-caption-letter-spacingCaption letter spacing
--hy-sidebar-group-caption-text-transformCaption text-transform (default: uppercase)
--hy-sidebar-group-gapGap between caption and items
--hy-sidebar-group-expand-durationTransition duration for the group expand and collapse animation
--hy-sidebar-group-expand-easingTransition easing for the group expand and collapse animation

Built with Lit. Documented with VitePress.