datui
Color scheme

Data display

Accordion

A single expandable section: an Accordion.Summary row that toggles an animated Accordion.Content body.

import { Accordion, AccordionSummary, AccordionContent, AccordionIcon } from "datui";

Examples

Basic

Unlimited projects, 100 GB of storage and priority support.

Controlled, one at a time

Use open/onOpenChange to keep only one section open. unmountOnCollapse drops closed content.

Name, email and password.

Accessibility

  • The summary is a <button> with aria-expanded and aria-controls; Enter and Space toggle it.
  • The content is a role="region" labelled by the summary.
  • Collapsed content is inert and visibility: hidden (or unmounted with unmountOnCollapse), so it is out of the tab order and hidden from assistive tech.
  • The height animation uses motion tokens and is instant under prefers-reduced-motion.
  • disabled disables the summary button.

API

Accordion

Single expandable section: `Accordion.Summary` row plus `Accordion.Content` body.

PropTypeDefaultDescription
classNamestring—
defaultOpenbooleanfalse
disabledboolean—
onOpenChange((open: boolean) => void)—
openboolean—
unmountOnCollapsebooleanfalseRemove the content from the DOM when collapsed (after the closing animation).

AccordionSummary

Header row that toggles the Accordion. A `button` with `aria-expanded` and `aria-controls`.

PropTypeDefaultDescription
activatedboolean—Keep the pressed look, e.g. for the active item of a list.
afterReactNode—Trailing content, e.g. a switch, counter or button-free text.
asElementType<any, keyof IntrinsicElements>—Element to render. Defaults to `a` with `href`, `button` with `onClick`, otherwise `div`.
badgeAfterSubtitleReactNode—
badgeAfterTitleReactNode—
badgeBeforeSubtitleReactNode—
badgeBeforeTitleReactNode—
beforeReactNode—Leading content, e.g. an icon or avatar.
classNamestring—
collapseIconElementType<any, keyof IntrinsicElements>animated chevron up
disabledboolean—
expandIconElementType<any, keyof IntrinsicElements>animated chevron down
extraSubtitleReactNode—
hasActivebooleantrueBackground tint while pressed.
hasHoverbooleantrueBackground tint on hover.
hrefstring—
iconPosition"none" | "before" | "after"afterWhere the expand icon sits; `none` hides it.
indicatorReactNode—Secondary value shown before `after`, e.g. the current setting.
multilinebooleanfalseWrap long text instead of truncating it.
overTitleReactNode—Small text above the title.
relstring—
subtitleReactNode—
targetstring—
type"button" | "submit" | "reset"—

AccordionContent

Collapsible body. A `region` labelled by the summary, hidden from assistive tech while collapsed.

PropTypeDefaultDescription
classNamestring—

AccordionIcon

Expand/collapse icon bound to the surrounding Accordion's state, for custom summaries.

PropTypeDefaultDescription
classNamestring—
collapseIconElementType<any, keyof IntrinsicElements>animatedIcon("chevron-up", (c) => ( <motion.path animate={c} variants={nudge("y", -2)} d="m18 15-6-6-6 6" /> ))Icon shown while expanded.
expandIconElementType<any, keyof IntrinsicElements>animatedIcon("chevron-down", (c) => ( <motion.path animate={c} variants={nudge("y", 2)} d="m6 9 6 6 6-6" /> ))Icon shown while collapsed.