Search documentation

Search the documentation and open a page.

A vertically stacked set of interactive headings that each reveal a section of content.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/accordion

Composition

<app-accordion> └── <app-accordion-item> ├── <app-accordion-trigger> │ └── <app-accordion-item-indicator> (optional) └── <app-accordion-content>

Examples

Card

Loading...

Controlled

Loading...

Default

Loading...

Separated Items

Loading...

With Form Fields

Loading...

With Icons

Loading...

API Reference

<app-accordion>

Inputs

InputTypeDefaultDescription
idstring | undefinedgeneratedUnique identifier used to create the accordion part IDs.
idsAccordionElementIds | undefined—Overrides the generated IDs for individual parts.
valuestring[] | undefined—Expanded item values when controlled. Supports Angular two-way binding.
defaultValuestring[] | undefined—Initially expanded item values when uncontrolled.
multiplebooleanfalseAllows more than one item to be expanded.
collapsiblebooleanfalseAllows every item to be collapsed.
disabledbooleanfalseDisables interaction with every item.
orientation"horizontal" | "vertical" | undefined"vertical"Sets the accordion orientation and keyboard navigation axis.
lazyMountbooleanfalseMounts an item's content only after the item is first expanded.
unmountOnExitbooleanfalseRemoves an item's content from the DOM when the item is collapsed.

Outputs

OutputTypeDescription
valueChangestring[] | undefinedEmits the updated array of expanded values.
focusChangeAccordionFocusChangeDetailsEmits when the focused accordion item changes.

<app-accordion-item>

Inputs

InputTypeDefaultDescription
valuestringrequiredUnique value that identifies the item.
disabledbooleanfalsePrevents the item from being expanded.

Context, Providers, and Utilities

ExportAngular API
AccordionRootProviderDirective that provides an externally created accordion API through value.
AccordionContextStructural directive [accordion-context] exposing the root API to a template.
AccordionItemContextDirectiveStructural directive [accordion-item-context] exposing the current item state.
useAccordion(options)Creates the signal-backed accordion machine inside an Angular injection context.
injectAccordionContext()Injects the nearest root accordion context.
injectAccordionItemContext()Injects the nearest accordion item context.

Types

ExportDescription
AccordionApiConnected accordion state and actions.
AccordionElementIdsOverrides for generated accordion part IDs.
AccordionFocusChangeDetailsDetails emitted by focusChange.
AccordionValueChangeDetailsDetails produced by the underlying state machine.