Web · Components
Accordion
A list of collapsible sections (FAQ, filter groups, settings).
5 exports
Live example
Preview
How long does shipping take?
Orders are delivered within 1-3 business days.
Can I return it?
You can return it for free within 14 days.
Which payment methods are there?
Credit card, debit card and bank transfer.
Code
Events
- Events appear here when you interact with the preview.
Import
A list of collapsible sections (FAQ, filter groups, settings). Sections are given with the items array. A server component.
Built on native <details>/<summary> elements:
- Needs no JavaScript; keyboard and screen reader support is built in.
- The browser's find in page (Ctrl+F) also finds text in closed sections and opens that section automatically.
exclusiveprovides single-open behavior with the nativenameattribute.- The height animation is CSS only (
interpolate-size); in browsers without support it works without animation.
Examples
AccordionItem
interfaceA section inside an Accordion.
| Name | Type | Description |
|---|---|---|
value? | string | Unique value of the section; matched with defaultValue. Its index is used when omitted. |
title | ReactNode | Text in the header row. |
description? | ReactNode | Small description below the title. |
icon? | IconProp | Icon at the start of the header: a name or an element. |
content | ReactNode | Content visible while the section is open. |
disabled? | boolean | Can't be opened. |
AccordionVariant
typeAppearance of the sections.
line: a line between sections.card: each section is a separate bordered box.
AccordionClassNames
interfaceClasses that can be given to the inner parts of Accordion.
| Name | Type | Description |
|---|---|---|
item? | string | Each section (<details>). |
trigger? | string | Header row (<summary>). |
content? | string | Content area. |
AccordionProps
interfaceProps of the Accordion component.
Extends: Omit<ComponentProps<"div">, "children" | "defaultValue">
| Name | Type | Default | Description |
|---|---|---|---|
items | readonly AccordionItem[] | Sections. | |
exclusive? | boolean | false | When true only one section stays open at a time; opening one closes the other. |
defaultValue? | string | readonly string[] | Value(s) of the section(s) open initially. | |
variant? | AccordionVariant | CustomVariant<"accordion"> | "line" | Appearance: built-in or a custom style added with defineAppearance (its classes are added to each section; drawn in the line layout when extends is omitted). Defaults to UIProvider appearance.defaults.accordion.variant. |
effect? | EffectProp | Effect or effects applied to each section's header row (e.g. "ripple", ["border", "glow"]). Defaults to UIProvider appearance.defaults.accordion.effect. See BuiltinEffect. | |
classNames? | AccordionClassNames | Classes added to the inner parts. |