Skip to main content
Version: latest
Works everywhere

Accordion works in both server and client environments. Always use the standard import (e.g. @prokodo/ui/accordion) — the library detects the runtime automatically.

Accordion

The Accordion component renders a list of collapsible panels. Each panel can be independently toggled or controlled. Supports animated expansion and full ARIA disclosure pattern.

Live demo →

Overview

import { Accordion } from "@prokodo/ui/accordion"
;<Accordion
items={[
{ title: "Panel 1", content: <p>Content A</p> },
{ title: "Panel 2", content: <p>Content B</p> },
]}
/>

Import

import { Accordion } from "@prokodo/ui/accordion"

CSS:

import "@prokodo/ui/accordion.css"

Props

PropTypeDefaultRequiredDescription
idstringOptional id for the root element.
itemsAccordionItem[]Array of accordion items.
multiExpandbooleanfalseAllow multiple items open simultaneously.
hideHeaderOnExpandbooleanfalseHide the header when an item is expanded.
headerWrapperClassNamestringCSS class on the header wrapper.
headerToggleClassNamestringCSS class on the header toggle button.
classNamestringCSS class on root element.
onChange(id: string, open: boolean) => voidCalled when an item is toggled.

See src/components/accordion/Accordion.model.ts for the full AccordionProps type.


Design Tokens

Customise Accordion via CSS custom properties on :root or a scoped ancestor.

TokenDefaultDescription
--pk-accordion-radiusvar(--pk-radius-md)Accordion item corner radius
--pk-accordion-bordervar(--pk-color-border)Item border colour
--pk-accordion-border-focusvar(--pk-color-brand)Focused item border colour
--pk-accordion-shadowvar(--pk-shadow-sm)Item box-shadow
--pk-accordion-header-bgvar(--pk-color-surface)Header background
--pk-accordion-content-bgvar(--pk-color-surface)Content panel background
--pk-accordion-fgvar(--pk-color-fg)Text colour
--pk-accordion-padding-xvar(--pk-space-lg)Horizontal padding
--pk-accordion-padding-yvar(--pk-space-md)Vertical padding
--pk-accordion-gradient-fromvar(--pk-color-brand)Hover gradient start
--pk-accordion-gradient-tovar(--pk-color-accent)Hover gradient end
--pk-accordion-item-tintvar(--pk-color-brand)Active item accent tint

AIC Note

Use the standard import path in application code:

import { Accordion } from "@prokodo/ui/accordion"

No separate /client or /lazy import selection is required in consumer code.

AIC components also support a priority flag for critical above-the-fold elements. This is most visible on Image (native preloading via <link rel="preload"> for above-the-fold content).


WCAG 2.2 Status

CriterionNameStatusNote
1.3.1Info and Relationships (A)✅ FulfilledSemantic structure (headings, lists, labels, landmarks) must be conveyed programmatically via HTML or ARIA.
2.1.1Keyboard (A)✅ FulfilledAll functionality must be operable via keyboard alone, without requiring specific timing.
2.4.3Focus Order (A)🔍 Manual reviewThe keyboard focus sequence must preserve meaning and operability in the complete page integration context.
2.4.7Focus Visible (AA)🔍 Manual reviewA visible keyboard focus indicator must be present on every interactive element. Verify against the applied product theme.
2.4.11Focus Not Obscured (Min.) (AA)🔍 Manual reviewThe focused component must not be fully hidden by sticky headers, overlays, or other positioned page elements.
4.1.2Name, Role, Value (A)✅ FulfilledName, role, and state of all interactive UI components must be programmatically determinable via native HTML semantics or ARIA.

Test coverage: 3 jest-axe assertion(s) across 5 test file(s) · 4 ARIA attribute occurrence(s) in source scan. Criteria marked 🔍 require manual verification in the final product integration and theme context.

Storybook

👉 Open Accordion in Storybook


Source

src/components/accordion/Accordion.model.ts