Accordion
Accordion whose pixel plus signs fold into minus signs while the panels open smoothly; one or several items can stay open.
Playground
Change a prop and the component re-renders. Props marked remounts set an initial value, so the component starts over.
<PxAccordion
defaultValue={[
"What is Ultracode?"
]}
items={[
{
title: "What is Ultracode?",
content: "A Claude Code mode that sends xhigh effort and lets Claude plan multi-agent workflows on its own."
},
{
title: "How is usage counted?",
content: "Usage resets weekly. Longer reasoning and more agents use more of it."
},
{
title: "Can I export my data?",
content: "Yes. Settings has an export that includes chats, projects and files."
}
]}
/>Installation
pnpm dlx shadcn@latest add @lumesec/px-accordionFirst timeRegister the @lumesec registry once, or install by URL+
Adds @lumesec to your components.json:
pnpm dlx shadcn@latest registry add @lumesec=https://elements.lumesec.ai/r/{name}.jsonOr skip the setup and install by URL:
npx shadcn@latest add https://elements.lumesec.ai/r/px-accordion.jsonUsage
import { PxAccordion } from "@/components/lumesec/px-accordion";
export function Example() {
return (
<PxAccordion
defaultValue={["What is Ultracode?"]}
items={[
{ title: "What is Ultracode?", content: "A Claude Code mode that sends xhigh effort." },
{ title: "How is usage counted?", content: "Usage resets weekly." },
]}
/>
);
}Behaviour
Pixel plus signs fold into minus signs, panels open smoothly and a dotted rail marks the open answer. Add multiple to allow several open at once.
API reference
Props
Also accepts every prop of <div> (React.ComponentProps<"div">), spread onto the root element.
valueTypestring[]Controlled list of open items (their value, or title). Use with onValueChange.
defaultValueTypestring[]Default[]Items open initially when uncontrolled.
itemsTypereadonly PxAccordionItem[]The sections: { value?: string; title: string; summary?: string; content: React.ReactNode }. value defaults to title; summary adds muted text at the end of the header.
multipleTypebooleanDefaultfalseLets several items stay open; without it, opening one closes the others.
onValueChangeType(value: string[]) => voidCalled with the open items whenever the user opens or closes one.
Ref
ref points at the root HTMLDivElement.
Keyboard
| Keys | Action |
|---|---|
| Enter / Space | Open or close the focused item. |
| ArrowDown / ArrowUp | Move focus to the next / previous header, wrapping. |
Accessibility
- Each header is a native button with
aria-expandedandaria-controls, inside an<h3>. - Each panel has
role="region"and anaria-labelwith the item title. - Closed panels are
inert, so their content leaves the tab order and the accessibility tree; the closing animation still plays. - The plus and minus icon is an
aria-hiddencanvas. - Reduced motion: panels open and close without the height and fade transitions, and the plus and minus icon switches at once.
Theming
Styled with Tailwind classes on your shadcn theme tokens, so light and dark follow your theme. The accent comes from --lumesec. See Theming.
This component reads --lumesec, --foreground, --muted-foreground and --border.
Notes
- Panels stay mounted while closed, so their content keeps its state.
Related
Was this page helpful?