Sidebar
An app-shell navigation landmark that collapses to icons.
Example
<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>import { Sidebar } from '@focsd-dev/react';
export function Example() { return <Sidebar label="Workspace">…</Sidebar>;}<script setup>import '@focsd-dev/components/focsd-sidebar.js';</script>
<template> <focsd-sidebar label="Workspace">…</focsd-sidebar></template>// Add CUSTOM_ELEMENTS_SCHEMA to the component's schemas, then:import '@focsd-dev/components/focsd-sidebar.js';
// template<focsd-sidebar label="Workspace">…</focsd-sidebar><script> import '@focsd-dev/components/focsd-sidebar.js';</script>
<focsd-sidebar label="Workspace">…</focsd-sidebar>API
Attributes
| Attribute | Property | Type | Default |
|---|---|---|---|
label | label | string | — |
collapsed | collapsed | boolean | false |
Slots
| Slot | Description |
|---|---|
(default) | Default content. |
CSS parts
Style the inside of the component with ::part(), for example focsd-sidebar::part(list).
| Part | Description |
|---|---|
list | The list element. |
nav | The nav element. |
toggle | The 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.
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.