Design system / Molecules
Molecule / Disclosure
Accordion
Accordion associates triggers with collapsible content regions. Single and multiple modes use different value shapes. The caller supplies content and, when controlled, the open-state contract.
Live example
Current component with fictional data. Example changes are not persisted.
Responsibility
Triggers and associated content regions form a focused disclosure contract. Radix owns the open-state mechanics unless controlled. Content inside a panel retains its own taxonomy and data-loading responsibilities.
Public contract
The table describes supported inputs, exported parts and caller responsibilities. A callback supplies a command, such as saving a draft. These notes are maintained manually; check current source types before integration.
| Prop / part | Type | Requirement | Responsibility |
|---|---|---|---|
| type | single | multiple | Required · Radix root | Controls whether the value is a string or string array. |
| value / defaultValue / onValueChange | string or string[] | Controlled or uncontrolled | Shape follows type. Consumer control does not imply shared state elsewhere. |
| collapsible | boolean | Single mode only | Allows closing the selected item in single mode. |
| value / disabled | Radix item props | Value required; disabled optional | Stable item identity and interaction availability. |
| children / className / primitive props | Radix part props | Composition | Trigger wraps children in a Radix Header; content className applies to an inner padding wrapper. |
API notes are curated documentation, not generated types. The source linked above is the current implementation; update these notes alongside API changes.
State and behavior
Identify which values the caller controls and which behavior the component or underlying primitive owns. A local example does not supply persistence, authorization or a complete product lifecycle.
Radix manages open items in uncontrolled usage; consumers can provide values and callbacks. This file has no feature hook, transport, loading or data policy.
Dependencies
- Radix Accordion Root, Item, Header, Trigger and Content
- Lucide ChevronDownIcon
- cn
Token and styling contract
These notes identify theme roles, utilities and direct style values used by the source. Direct colors or timings are implementation exceptions, not recommendations to bypass the theme.
border-b / border-ring / ring-ring- Item boundary and trigger focus roles.
text-md / text-muted-foreground- Body type and chevron role.
py-4 / pb-4 / gap-4- Trigger and inner content spacing.
animate-accordion-up / animate-accordion-down- Source state animation classes are used by the real Radix-backed preview.
Boundaries and limitations
- Available locally is not evidence of product adoption.
- Single and multiple modes have different value contracts; do not pass arrays to single mode.
- Content className is placed on an inner div; outer primitive props are forwarded separately.
- Do not conceal essential errors or required actions only inside a closed disclosure.
Where to make a change
Change generic disclosure structure and chevron styling in accordion.tsx; keep labels, open policy and domain content with the consumer. Preserve keyboard/focus and trigger/content associations when adapting primitives.
Selected real uses
No product consumer is recorded in this entry's selected-use notes. The implementation and specimen establish availability, not adoption. These notes are not an exhaustive usage scan.
These traces describe selected uses, not every dependency. Repository-only paths are shown as references; only approved files have public source views.
Usage contract
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from "@/components/ui/accordion";
<Accordion type="single" collapsible>
<AccordionItem value="help">
<AccordionTrigger>What does this setting affect?</AccordionTrigger>
<AccordionContent>{helpText}</AccordionContent>
</AccordionItem>
</Accordion>Illustrative consumer bindings, not a self-contained product workflow. Live examples supply only local state or explicit fictional props.