Accordion
Collapsible sections, one at a time or several at once.
import
import { Accordion, AccordionItem } from '@joshicodes/cock';Single and multiple
One at a time
Core Component Kit. The acronym was noticed afterwards and then kept on purpose.
Several at once
Yes. Maybe call it "the component kit" in the standup.
Behaviour
- `type="multiple"` takes an array as its bound value; the single variant takes a string.
API
Read out of the component sources at build time, so it matches the version you installed.
Every component also takes class, merged
through tailwind-merge so your utility wins.
<Accordion>
Props
| Prop | Type | Default |
|---|---|---|
type `single` closes the others when one opens. | 'single' | 'multiple' | 'single' |
value bindableOpen item value(s). Bindable. | string | string[] | type === 'single' ? '' : [] |
class | string | — |
Snippets
| Snippet | Type | Default |
|---|---|---|
children | Snippet | — |
<AccordionItem>
Props
| Prop | Type | Default |
|---|---|---|
value required | string | — |
title required | string | — |
disabled | boolean | false |
class | string | — |
Snippets
| Snippet | Type | Default |
|---|---|---|
children | Snippet | — |