Dot Accordion
Each question sits on a rule of dots. Opening one folds the upright of its dotted plus into the middle, lights the rule under it, and lets the answer in through a dither dissolve. Links like #refunds open their answer, find-in-page opens the one holding the match, and the questions are real headings with full keyboard support.
Needs: None. DOM, CSS masks and one small animation loop.
Customize
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| items | { question: string; answer: ReactNode; id?: string }[] | required | The questions and their answers. The id, made from the question when left out, is what #links open. |
| multiple | boolean | false | Let several stay open at once. Off: opening one shuts the others. |
| defaultOpen | number | number[] | – | Open at first. |
| onChange | (open: number[]) => void | – | Called with the open items' indexes when they change. |
| heading | 2 | 3 | 4 | 5 | 6 | 3 | The heading level of the questions, so they fit the page's outline. |
| tone | string | "" | The open item's colour: its minus and lit rule. The accent when unset. |
| className | string | – | Class on the root. |
| style | CSSProperties | – | Style on the root. Theme it through the --mlui-* variables. |