Skip to content
75NeoUI

component · react

Accordion

Three variants across three sizes, wrapping Ark UI for keyboard and ARIA behaviour.

accordion

Rows are data rather than markup. Pass items and the accordion renders the whole anatomy, so keyboard navigation, ARIA wiring and the open-state animation come with it.

<Accordion
  items={[
    { value: "shipping", label: "Shipping", content: "Two to four working days." },
    { value: "returns", label: "Returns", content: "Thirty days, no questions." },
  ]}
/>
<Accordion
  :items="[
    { value: 'shipping', label: 'Shipping', content: 'Two to four working days.' },
    { value: 'returns', label: 'Returns', content: 'Thirty days, no questions.' },
  ]"
/>

multiple allows more than one row open at a time. collapsible allows closing the open row and leaving none open. An item carries its own disabled and its own icon, shown before that row’s label.

Arbitrary markup in a row

label and content on an item are text. When a row needs more than text, replace it: renderLabel and renderContent in React, the label and content slots in Vue. Both receive the item and fall back to its text when you render nothing.

<Accordion items={items} renderContent={(item) => <Invoice id={item.value} />} />
<Accordion :items="items">
  <template #content="{ item }">
    <Invoice :id="item.value" />
  </template>
</Accordion>

Slots

The same word names the recipe slot, the data-slot attribute and the key in ui.

  • base
  • item
  • header
  • trigger
  • leadingIcon
  • label
  • trailingIcon
  • content
  • body

Variants

Read off the recipe, so these are the values that actually resolve. A Theme layer can change which one is the default; it cannot add a value.

variant
outlinesoftghost
size
smmdlg

Props

Taken by both adapters, read out of the component module. The same names and the same types work in React and Vue.

ui

AccordionUI

Per-slot class overrides.

variant

"outline" | "soft" | "ghost"

Defaults to "outline"

size

"sm" | "md" | "lg"

Defaults to "md"

itemsrequired

AccordionItem<ReactNode>[]

The rows to render, in order.

multiple

boolean

Allow more than one row open at a time.

collapsible

boolean

Allow closing the open row, leaving none open.

disabled

boolean

Disable every row.

orientation

"horizontal" | "vertical"

Defaults to "vertical"

trailingIcon

ReactNode

Replaces the chevron on every row.

React only

Also takes Omit<React.HTMLAttributes<HTMLDivElement>, "defaultValue" | "dir">. A className among them reaches the base slot.

renderLabel

(item: AccordionItem<React.ReactNode>) => React.ReactNode

Replace an item's heading with arbitrary markup. Falls back to `item.label`.

renderContent

(item: AccordionItem<React.ReactNode>) => React.ReactNode

Replace an item's body with arbitrary markup. Falls back to `item.content`.