Skip to content

Accordion ​

Accordion runtime: Root supports single/multiple, Item provides a unique value, Trigger/Content form each entry.

Runtime ​

State contracts come from @varo-ui/headless; rendered parts come from @varo-ui/h5/primitives or @varo-ui/weapp/primitives.

Demo ​

Package@varo-ui/headless
Body one

Basic usage ​

Use the Demo panel above to switch H5 and Weapp primitive preview/code; each runtime renders only the current entry.

Multiple mode ​

With type="multiple", value is an array; item values must stay unique.

Parts ​

PartPurpose
AccordionRootCollection state
AccordionItemOne entry
AccordionTriggerEntry title
AccordionContentEntry body

Props ​

AccordionRoot ​

PropTypeDefaultDescription
type'single' | 'multiple'implementation defaultSingle or multiple open
valuestring | string[] | undefinedundefinedControlled value
defaultValuestring | string[]undefinedUncontrolled initial value
collapsiblebooleanfalseAllow all collapsed in single mode
disabledbooleanfalseDisable whole root
idstringundefinedAssociation id

AccordionItem ​

PropTypeDescription
valuestringUnique item value
disabledbooleanItem disabled

Events ​

EventPayloadDescription
update:valuestring | string[]Controlled sync
valueChangestring | string[]Value change

Accessibility ​

  • Item value associates Trigger/Content.
  • Disabled items cannot expand.

Platform notes

  • Both runtimes share single/multiple contracts.
  • Motion and icons belong to UI wrappers. :::