Accordion · animated
Sections that open with a smooth height animation — no measuring — in three looks, single or multiple, controlled or not, with full keyboard support.
Line · icons, subtitles, a badge, a disabled section
Card · one open at a time · plus indicator
A tiny fine-grained reactive UI library — signals, no virtual DOM, no build step.
Contained · controlled from outside · chevron first
open: a
Orders placed before 14:00 leave the warehouse the same day.
Usage
import { signal } from "./index.js";import { Accordion } from "./components/accordion.js"; // items: title + content (a builder) or text; icon, subtitle, extra, disabledAccordion({ defaultOpen: ["profile"], items: [ { id: "profile", icon: userSvg, title: "Profile", subtitle: "Name, photo and bio", content: () => html`<input class="zap-input" bind=${name} />` }, { id: "billing", title: "Billing", disabled: true, text: "Team plan only" },] }) // one open at a time; + turns into −Accordion({ variant: "card", multiple: false, indicator: "plus", items: faq }) // controlled: the open ids are a signal you can read and setconst open = signal(["a"]);Accordion({ variant: "contained", chevron: "start", value: open, items, onChange: (ids) => console.log(ids) })open.set(["a", "b", "c"]); // expand all // variant: "line" · "card" · "contained"// a body is built on first open and kept; destroyOnClose: true disposes it