Skip to content
Porcelana

Accordion

Expandable sections, one or many open at a time.

Data & displayRadix primitive ↗

Example

Mon–Fri at 06:00. Weekends stay quiet unless you add them.

Example.tsx
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@porcelana/ui";

export default function Example() {
  return (
    <Accordion type="single" collapsible defaultValue="repeat">
      <AccordionItem value="repeat">
        <AccordionTrigger>Repeat on weekdays</AccordionTrigger>
        <AccordionContent>Mon–Fri at 06:00. Weekends stay quiet unless you add them.</AccordionContent>
      </AccordionItem>
      <AccordionItem value="sound">
        <AccordionTrigger>Sound</AccordionTrigger>
        <AccordionContent>Morning chime, rising volume over 30 seconds.</AccordionContent>
      </AccordionItem>
    </Accordion>
  );
}

Import

Import
import { Accordion, AccordionTrigger } from "@porcelana/ui";
import "@porcelana/ui/styles.css"; // once, at your app root

Props

Generated from the TypeScript types. Standard HTML attributes are passed through and not listed.

Accordion

PropTypeDefaultDescription
typerequired"single" | "multiple"–Button type (defaults to "button").
aria-labelstring–Defines a string value that labels the current element. @see aria-labelledby.
asChildboolean–Render the single child element instead, merging props and behaviour onto it.
collapsiblebooleanfalseWhether an accordion item can be collapsed after it has been opened.
defaultValuestring | string[]–The value of the item whose content is expanded when the accordion is initially rendered. Use `defaultValue` if you do not need to control the state of an accordion. The value of the items whose contents are expanded when the accordion is initially rendered. Use `defaultValue` if you do not need to control the state of an accordion.
dirDirection–The language read direction.
disabledboolean–Whether or not an accordion is disabled from user interaction. @defaultValue false
idstring–Element id. Generated automatically when omitted.
onValueChange((value: string) => void) | ((value: string[]) => void)–The callback that fires when the state of the accordion changes.
orientationOrientationverticalThe layout in which the Accordion operates.
valuestring | string[]–The controlled stateful value of the accordion item whose content is expanded. The controlled stateful value of the accordion items whose contents are expanded.

AccordionTrigger

PropTypeDefaultDescription
aria-labelstring–Defines a string value that labels the current element. @see aria-labelledby.
asChildboolean–Render the single child element instead, merging props and behaviour onto it.
disabledboolean–Prevents interaction and dims the control.
idstring–Element id. Generated automatically when omitted.
level2 | 3 | 4 | 5 | 63Heading level of the wrapping header element. Defaults to 3.
type"button" | "submit" | "reset"–Button type (defaults to "button").

Accessibility

  • Each trigger sits in a heading (level prop) and exposes aria-expanded; panels are labelled regions.
  • Enter and Space toggle; arrows move between triggers.

Mobile

  • 56px trigger rows.