Data display

Accordion

A stack of native disclosures that open independently or one at a time, without JavaScript.

Class nameTypeDescription
accordionplf:accordionComponentGroups the items
accordion-itemplf:accordion-itemPartA native details item
accordion-triggerplf:accordion-triggerPartThe item's summary
accordion-titleplf:accordion-titlePartThe trigger's label
accordion-iconplf:accordion-iconPartAn SVG icon before the title; an icon class there doesn't need it
accordion-contentplf:accordion-contentPartThe panel shown when open
accordion-arrowplf:accordion-arrowModifierEnds each title with a chevron that turns over while open

Default

Keep links and form controls out of the summary, and add no roles or aria-expanded: the browser already exposes the state and handles the pointer, Enter and Space.

Item one
Content for item one.
Item two
Content for item two.
Item three
Content for item three.

One item at a time

Give every item in a group the same name, unique to that group in the document.

Item one
Content for item one.
Item two
Content for item two.
Item three
Content for item three.
Item one
Content for item one.
Item two
Content for item two.

React

Accordion from @pelatform/react renders this markup with no script, and each part is a component of its own; an Icon in the trigger needs no class.

Prop Values Default
arrow true ends each title with a chevron that turns over while open false

The parts:

Part Element
AccordionItem A details with accordion-item, whose open, onToggle and name are its own
AccordionTrigger A summary with accordion-trigger
AccordionTitle A span with accordion-title
AccordionContent A div with accordion-content

Other props are the element’s own, className and ref included.

CSS variables

Override on a root or on a single accordion.

Variable Default
--plf-accordion-bg Transparent
--plf-accordion-color Text
--plf-accordion-border Subtle border, between items
--plf-accordion-hover-bg Muted surface, on the hovered trigger
--plf-accordion-content-color Muted text
--plf-accordion-padding-block, --plf-accordion-padding-inline Space 3 (12px), for the trigger and the content
--plf-accordion-icon-size The control icon size (16px), for the icon and the chevron

Built with Pelatform UIv0.1.0

Components

Getting started

Foundations

Components

Actions

Data display

Navigation

Feedback

Data input

Layout

Advanced

Integrations

Blocks

Application

Authentication

Icons