Module-tier shell sidebar — owns resize, snap-to-collapsed, persistence, and the [collapsed] reflected attribute. Sits inside <admin-shell> as slot="leading" or slot="trailing". Authors compose chrome bars + content inside via slot vocabulary.
Drop into <admin-shell> as a slotted child. Add resizable to wire the drag handle, collapsible to wire programmatic collapse.
The sidebar reflects its state on the element itself — no data-* proxy attributes, no threshold math from the outside.
| Attribute | When set | Use for |
|---|---|---|
collapsed | Width is at or below 96px (snap floor) | CSS :has(admin-sidebar[collapsed]) selectors; JS .hasAttribute('collapsed') |
resizing | Active pointer-drag | Suppress transitions during drag |
The reflection is round-tripped — set collapsed programmatically and the sidebar will width-snap; release the attribute and it expands to the previously-saved width.
| Method | Effect |
|---|---|
.toggle() | Flip collapsed state. Returns the new collapsed value. |
.collapse() | Force collapsed (idempotent if already collapsed). |
.expand() | Restore the previous expanded width. |
| Event | Detail |
|---|---|
sidebar-toggle | { name, expanded } — bubbles when collapsed/expanded |
sidebar-resize | { name, width } — bubbles after a pointer-drag releases |
| Prop | Type | Default | Description |
|---|---|---|---|
resizable | boolean | false | Opts in to drag-to-resize. Author supplies a child [data-resize] element. |
collapsible | boolean | false | Opts in to .toggle()/.collapse()/.expand(). |
name | string | (slot value) | localStorage namespace override. |
min-width | string | (CSS min-width) | Override for the snap-floor width. |
collapsed | boolean | — | Reflected — set when width ≤ 96px. |
resizing | boolean | — | Reflected — set during active drag. |
Width is saved to localStorage on every drag release + every toggle, under the key adia-sidebar-{name} (where name defaults to the slot value). On reconnect, the saved width is restored — the “previous expanded width” tracker preserves the user's preferred expanded size across collapse cycles.