Skip to content
Focsd homeFocsd homeFocsd
Forms

Sidebar

An app-shell navigation landmark that collapses to icons.

  • Tag: focsd-sidebar
  • Pattern: Navigation landmark + collapse
  • Category: Navigation

Example

HTML
<focsd-sidebar label="Workspace">
<focsd-sidebar-item href="#" icon="menu" current>Projects</focsd-sidebar-item>
<focsd-sidebar-item href="#" icon="search">Members</focsd-sidebar-item>
<focsd-sidebar-item href="#" icon="settings">Settings</focsd-sidebar-item>
</focsd-sidebar>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/components/focsd-sidebar.js';
</script>
<focsd-sidebar label="Workspace">…</focsd-sidebar>

API

Attributes

AttributePropertyTypeDefault
labellabelstring—
collapsedcollapsedbooleanfalse

Slots

SlotDescription
(default)Default content.

CSS parts

Style the inside of the component with ::part(), for example focsd-sidebar::part(list).

PartDescription
listThe list element.
navThe nav element.
toggleThe toggle element.

Accessibility

  • A <nav aria-label> landmark with a collapse <button aria-expanded>; its name stays "Collapse sidebar" while the state changes.
  • When collapsed, item labels stay available as accessible names.