Accordion

Radix accordion with sketch dividers between items and a hand-drawn chevron that rotates on expand.

A number that locks the wobble. Omit it and Shuffle redraws every line.

<Accordion defaultValue="one" roughness={1.5}>
  <AccordionItem value="one">
    <AccordionTrigger>What is a seed?</AccordionTrigger>
    <AccordionContent>A number that locks the wobble.</AccordionContent>
  </AccordionItem>
</Accordion>

CLI install

npx doodleui-react add accordion

Usage

import {
  Accordion,
  AccordionItem,
  AccordionTrigger,
  AccordionContent,
} from "doodleui-react";

<Accordion defaultValue="one">
  <Accordion.Item value="one">
    <Accordion.Trigger>What is a seed?</Accordion.Trigger>
    <Accordion.Content>A number that locks the wobble.</Accordion.Content>
  </Accordion.Item>
</Accordion>

{/* Named exports also work */}
<AccordionItem value="two">…</AccordionItem>

Keyboard, collapse, and ARIA come from Radix. doodle-ui draws the rules and the chevron. See Controlled state.

Props

PropTypeDefaultNotes
type"single" | "multiple""single"One open panel, or many.
collapsiblebooleantrueWhen type is single, allows closing the open item.
defaultValue / valuestring | string[]undefinedOpen item id(s).
roughnessnumber1.5How wobbly the stroke is. 0 is almost geometric. 3+ is messy.
seednumberprovider / randomLocks the sketch. Omit to follow SketchSeedProvider (Shuffle) or a mount-time random seed.
sketchColorstring#1f1d1aStroke color. Also tints primary/accent fills where relevant.
classNamestringundefinedPassed through to the root element.
styleCSSPropertiesundefinedPassed through to the root element.