Quick Start
Build a working collapsible (or accordion) on a page. By the end, click and keyboard activation toggle the panel.
1. Install once
Add the package and import the runtime in your entry point:
npm install monochromeimport "monochrome"For CDN setup and browser support, see Installation.
2. Paste the HTML
<button
type="button"
id="mct:collapsible:demo"
aria-expanded="false"
aria-controls="mcc:collapsible:demo"
>
Show content
</button>
<div
id="mcc:collapsible:demo"
aria-labelledby="mct:collapsible:demo"
aria-hidden="true"
hidden
>
This content toggles when you click the button.
</div>Prefer an accordion? Use the same pattern with mcr:, mct:, and mcc: IDs under an accordion root. See the Accordion reference.
3. Confirm it works
Load the page, then:
- Click the button. The panel should appear and
aria-expandedshould become"true". - Click again. The panel should hide.
- Focus the button with Tab and press Enter or Space. Keyboard activation should match mouse clicks.
No initialization call. The import registered the listeners; correct markup is enough.
Next
- Installation: what's included, browser support
- Frameworks: optional React and Vue wrappers that generate the markup
- Collapsible and Accordion: full contracts and variants
- Architecture: why this works without a state store