Accordion

Stacked sections that expand and collapse — single or multiple open, five visual variants.

Named colors like surface, label and stroke that resolve differently in light and dark mode — components never reference raw hex values.

Import#

import { Accordion } from "astralis-ui";
// Accordion.Item, Accordion.Trigger, Accordion.Content

Anatomy#

<Accordion type="single" collapsible>
  <Accordion.Item value="unique-id">
    <Accordion.Trigger>Heading</Accordion.Trigger>
    <Accordion.Content>Body</Accordion.Content>
  </Accordion.Item>
</Accordion>

Variants#

enclosed

Content of the first section.

outline

Content of the first section.

separated

Content of the first section.

subtle

Content of the first section.

plain

Content of the first section.

Multiple open#

type="multiple" lets any number of items stay open; value/defaultValue become arrays.

Several items can be open at once.

defaultValue takes an array in multiple mode.

Controlled#

Pass value + onValueChange to own the state — useful for "expand from elsewhere" flows like deep links or wizards.

Ships worldwide within 3–5 days.

Custom indicator#

Swap the chevron, move it to the leading edge, recolor with colorScheme, or disable individual items.

Props#

PropTypeDefaultDescription
type"single" | "multiple""single"One open item at a time, or any number.
variant"enclosed" | "outline" | "separated" | "subtle" | "plain""enclosed"Container styling family.
size"sm" | "md" | "lg""md"Trigger and content density.
colorScheme"gray" | "brand" | … (all 11 schemes)"gray"Accent hue for focus rings and highlights.
value · defaultValuestring | string[]Controlled / initial open item(s) — an array in multiple mode.
onValueChange(value: string | string[]) => voidFires with the next open value(s).
collapsiblebooleanfalseIn single mode, allows closing the open item.
disabledbooleanfalseDisables every item.
keepMountedbooleanfalseRender content in the DOM before first open (SEO / heavy content).
indicator · indicatorPosition · hideIndicatorReactNode · "start" | "end" · booleanchevron · "end" · falseCustomize or hide the rotating open indicator.
headingLevel1 – 63Heading level wrapping each trigger, for the document outline.

Accordion.Item#

Accordion.Trigger and Accordion.Content take only className (Trigger can also override indicator/hideIndicator per item).

PropTypeDefaultDescription
valuestringRequired — identifies the item in value/defaultValue.
disabledbooleanfalseDisables just this item.

Keyboard#

KeyAction
Enter / SpaceToggle the focused trigger
/ Next / previous trigger (wraps)
Home / EndFirst / last trigger

Accessibility#

  • Triggers are real buttons wrapped in headings (headingLevel), with aria-expanded and aria-controls.
  • Content regions use role="region" + aria-labelledby.