Skip to content
Navigation

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

PropTypeDefault
type

`single` closes the others when one opens.

'single' | 'multiple''single'
value bindable

Open item value(s). Bindable.

string | string[]type === 'single' ? '' : []
class
string—

Snippets

SnippetTypeDefault
children
Snippet—

<AccordionItem>

Props

PropTypeDefault
value required
string—
title required
string—
disabled
booleanfalse
class
string—

Snippets

SnippetTypeDefault
children
Snippet—

See also

cock. Yes, it stands for core component kit. We checked twice.