Accordion
Installation
Section titled “Installation”Copy editable source into an initialized application:
pnpm dlx @simurgh-ui/cli add accordionFor package consumption, import from the component subpath and load its optional recipe CSS:
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent,} from '@simurgh-ui/react/accordion';import '@simurgh-ui/styles/accordion.css';import { Accordion, AccordionItem, AccordionTrigger, AccordionContent,} from '@simurgh-ui/vue/accordion';import '@simurgh-ui/styles/accordion.css';Angular
Section titled “Angular”import { AccordionComponent, AccordionItemComponent,} from '@simurgh-ui/angular/accordion';import '@simurgh-ui/styles/accordion.css';Omit the component stylesheet for fully headless styling. CLI-copied components use the local path
written to simurgh.json and the copied application styles instead of these package imports.
Purpose
Section titled “Purpose”Each item combines a heading trigger and a labelled region. Single mode closes the previous item; multiple mode permits independent expansion.
Default presentation: headless
Section titled “Default presentation: headless”No default visual treatment is applied. The public component supplies behavior and semantics; consumers provide layout and appearance.
Basic usage
Section titled “Basic usage”Anatomy
Section titled “Anatomy”The public component parts are listed in API surface below. Use only the parts needed by the example; compound components depend on their documented parent/child nesting.
State model
Section titled “State model”This component exposes no public controlled/uncontrolled state pair. Configure it through the props, events, native attributes, or parent-owned state documented in the API tables.
Examples
Section titled “Examples”<Accordion type="single"> <AccordionItem value="shipping"> <AccordionTrigger>Shipping</AccordionTrigger> <AccordionContent>Ships in two days.</AccordionContent> </AccordionItem></Accordion><Accordion> <AccordionItem value="shipping"> <AccordionTrigger>Shipping</AccordionTrigger> <AccordionContent>Ships in two days.</AccordionContent> </AccordionItem></Accordion><simurgh-accordion> <simurgh-accordion-item value="shipping"> <span trigger>Shipping</span> <p>Ships in two days.</p> </simurgh-accordion-item></simurgh-accordion>Real-world example: dynamic FAQ items
Section titled “Real-world example: dynamic FAQ items”Use stable values so expanded state follows an item across filtering or reordering.
<Accordion type="multiple"> {faqItems.map((item) => ( <AccordionItem key={item.id} value={item.id}> <AccordionTrigger>{item.question}</AccordionTrigger> <AccordionContent>{item.answer}</AccordionContent> </AccordionItem> ))}</Accordion>Vue renders the same collection with v-for="item in faqItems" and :key="item.id". Angular uses
*ngFor="let item of faqItems; trackBy: trackBy"; trackBy must return item.id.
Keyboard interactions
Section titled “Keyboard interactions”These keys describe behavior implemented by the adapters. Native Tab, Enter, and Space behavior still applies to descendant links, buttons, and form controls unless the component overrides it.
| Concern / keys | Behavior |
|---|---|
| Focus entry and exit (Tab / Shift+Tab) | Tab enters and leaves through native summary controls. |
| Navigation and activation | Enter or Space toggles the focused item. |
| Escape | Not handled by the component. |
| RTL differences | No RTL-specific key mapping. |
| Typeahead | Not supported. |
Accessibility
Section titled “Accessibility”Preserve the documented composition and accessible names when wrapping or restyling this component. See accessibility and RTL guidance for keyboard, focus, labeling, and directionality requirements.
API surface
Section titled “API surface”- React exports:
Accordion,AccordionItem,AccordionTrigger,AccordionContent - Vue exports:
Accordion,AccordionItem,AccordionTrigger,AccordionContent - Angular exports:
AccordionComponent,AccordionItemComponent
Import these public symbols from the component subpath shown in Installation. Framework-specific props, events, slots, directives, methods, defaults, and native-attribute behavior belong in the API tables on this page; use the linked source only to verify the current implementation.
React API reference
An inherited-attributes entry means the component accepts the complete named React native interface, including its event handlers and ARIA and data attributes. Remaining attributes are forwarded to the rendered element unless the component behavior described on this page overrides them.
Accordion
Section titled “Accordion”Complete props type: PropsWithChildren<{ type?: "multiple" \| "single"; defaultValue?: string[]; }>.
| Prop | Type | Default / requirement |
|---|---|---|
children | ReactNode | undefined |
defaultValue | string[] | undefined |
type | "multiple" | "single" | undefined |
AccordionItem
Section titled “AccordionItem”Inherited attributes: HTMLAttributes<HTMLDivElement>.
| Prop | Type | Default / requirement |
|---|---|---|
children | ReactNode | undefined |
value | string | Required |
AccordionTrigger
Section titled “AccordionTrigger”Inherited attributes: ButtonHTMLAttributes<HTMLButtonElement>.
| Prop | Type | Default / requirement |
|---|---|---|
children | ReactNode | undefined |
AccordionContent
Section titled “AccordionContent”Inherited attributes: HTMLAttributes<HTMLDivElement>.
| Prop | Type | Default / requirement |
|---|---|---|
children | ReactNode | undefined |
Vue API reference
Boolean props without explicit defaults use Vue’s false default. Undeclared attributes follow
the fallthrough behavior stated for each component.
Accordion
Section titled “Accordion”Vue attribute fallthrough is enabled for the rendered root.
| Prop | Type | Default / requirement |
|---|---|---|
multiple | boolean | false |
defaultValue | string[] | () => [] |
No emitted events.
Slots: default.
Exposed methods: none.
AccordionItem
Section titled “AccordionItem”Vue attribute fallthrough is enabled for the rendered root.
| Prop | Type | Default / requirement |
|---|---|---|
value | string | Required |
No emitted events.
Slots: default.
Exposed methods: none.
AccordionTrigger
Section titled “AccordionTrigger”Vue attribute fallthrough is enabled for the rendered root.
No declared props.
No emitted events.
Slots: default.
Exposed methods: none.
AccordionContent
Section titled “AccordionContent”Vue attribute fallthrough is enabled for the rendered root.
No declared props.
No emitted events.
Slots: default.
Exposed methods: none.
Angular API reference
Angular
Section titled “Angular”Inputs and outputs use their public template names. Public methods are callable through a template
reference or ViewChild. Native attributes apply to the documented template root or directive host;
they are not automatically forwarded through component hosts.
AccordionComponent
Section titled “AccordionComponent”Component selector: simurgh-accordion. The template’s first native element is ng-content.
| Input | Type | Default / requirement |
|---|---|---|
multiple | boolean | false |
No outputs.
Content projection: default.
| Public method |
|---|
toggle(value: string): void |
AccordionItemComponent
Section titled “AccordionItemComponent”Component selector: simurgh-accordion-item. The template’s first native element is h3.
| Input | Type | Default / requirement |
|---|---|---|
value | string | '' |
No outputs.
Content projection: [trigger], default.
| Public method |
|---|
toggle(): void |
Composition contract
Section titled “Composition contract”Follow the framework example as a structural contract. Root components own shared state; parts that consume that state must stay under the root (or be attached to projected descendants in Angular). Parts described as conditional are optional until their corresponding interaction or semantic region is used. Do not render a state-consuming part by itself.
| Framework | Required parent/child relationship | Conditional parts | Supporting types |
|---|---|---|---|
| React | Render Accordion as the ancestor. Nest the listed parts inside that root so they can read its shared state/context. | AccordionItem, AccordionTrigger, AccordionContent are conditional parts: include only those needed by the documented anatomy. A trigger/control and its matching content/item are required when that interaction is used. | None. |
| Vue | Render Accordion as the ancestor. Nest the listed parts inside that root so they can read its shared state/context. | AccordionItem, AccordionTrigger, AccordionContent are conditional parts: include only those needed by the documented anatomy. A trigger/control and its matching content/item are required when that interaction is used. | None. |
| Angular | Create AccordionComponent first. Attach listed directives to elements inside its projected content; nested component parts must remain inside it. | AccordionItemComponent are conditional parts: include only those needed by the documented anatomy. A trigger/control and its matching content/item are required when that interaction is used. | None. |
Accessible names, descriptions, and form labels remain required whenever the component’s purpose cannot otherwise be determined, even when the corresponding visual part is optional.
Framework parity and differences
Section titled “Framework parity and differences”The adapters target the same user-visible behavior and accessibility contract. Their public shapes follow each framework’s conventions and are not expected to be symbol-for-symbol identical.
| Concern | Contract |
|---|---|
| Public composition | React exports 4 parts, Vue 4, and Angular 2. These are intentional composition differences; use each framework’s example rather than translating symbol-for-symbol. |
| State and change events | React uses controlled/default props and callbacks for value; Vue uses ordinary props/events; Angular uses inputs and outputs. |
| Children and content | React uses children; Vue uses the slots listed above; Angular uses the documented content projection selectors. |
| Native attributes | React forwards the named native interface; Vue follows the stated fallthrough rule; Angular attributes apply to the component host unless an input, directive, or documented native root consumes them. |
| Imperative access | React has no forwarded ref; Vue exposes no methods; Angular exposes the listed class methods through a template reference or ViewChild. |
These differences are intentional adapter design. Behavioral or accessibility differences not stated on this page are parity defects rather than supported variations.
Form integration
Section titled “Form integration”This component is not a form control and does not contribute a named value to FormData. Use it
to structure or describe a form only when its purpose and accessibility guidance apply.
Supported states
Section titled “Supported states”The table distinguishes component behavior from application-owned presentation. “Not supported” means there is no public state contract for that adapter; do not invent one with an undocumented attribute. Keep status and error messages accessible when they are rendered outside the component.
| State | React | Vue | Angular |
|---|---|---|---|
| Loading | Not supported by this component API; handle this state in surrounding application UI. | Not supported by this component API; handle this state in surrounding application UI. | Not supported by this component API; handle this state in surrounding application UI. |
| Empty | Not supported by this component API; handle this state in surrounding application UI. | Not supported by this component API; handle this state in surrounding application UI. | Not supported by this component API; handle this state in surrounding application UI. |
| Invalid | Not supported by this component API; handle this state in surrounding application UI. | Not supported by this component API; handle this state in surrounding application UI. | Not supported by this component API; handle this state in surrounding application UI. |
| Read-only | Not supported by this component API; handle this state in surrounding application UI. | Not supported by this component API; handle this state in surrounding application UI. | Not supported by this component API; handle this state in surrounding application UI. |
| Disabled | Supported with disabled={true} on the documented control or interactive part; its interaction is blocked. Disabled form controls are omitted from submission. | Not supported by this component API; handle this state in surrounding application UI. | Not supported by this component API; handle this state in surrounding application UI. |
| Error | Not supported by this component API; handle this state in surrounding application UI. | Not supported by this component API; handle this state in surrounding application UI. | Not supported by this component API; handle this state in surrounding application UI. |
Styling contract
Styling contract
Section titled “Styling contract”The selectors below are used by the published component recipe or emitted consistently by an adapter. Treat these as the supported styling surface. Element order, anonymous wrappers, and undocumented descendants are implementation details and should not be targeted.
| Surface | Stable hooks |
|---|---|
| Recipe classes | No component-specific recipe class; this stylesheet currently imports shared tokens only. |
| Stable DOM parts | No named data-slot parts are emitted; target the forwarded root class or attributes documented in the API. |
| Stable data attributes | No documented data-* hook. |
| ARIA/state selectors used by the recipe | No ARIA state selector is used by this recipe. |
| CSS custom properties consumed | No component-specific token consumption beyond the shared token import. |
Prefer a semantic token override for theme-wide changes. Use the listed class or part selectors for a component-scoped override. When omitting recipe CSS, preserve state attributes and ARIA semantics even if your replacement styles use different selectors.
Customization
Section titled “Customization”Load the optional component stylesheet for the default recipe, override semantic tokens for broad theme changes, or omit the recipe CSS for headless styling. See theming and styling hooks for import order, selectors, dark mode, RTL, and reduced-motion guidance.
Last verified on 2026-08-13 against Simurgh registry 0.1.1.
Related components
Section titled “Related components”- Review the shared accessibility and RTL guidance and theming and styling hooks.
- Use the component chooser and component overview to compare related primitives.
- Inspect the registry manifest and framework source for React, Vue, or Angular.