React
Usage
import { Accordion } from '@zalify-ui/react'
<Accordion.Root>
<Accordion.Item>
<Accordion.ItemTrigger>
<Accordion.ItemIndicator />
</Accordion.ItemTrigger>
<Accordion.ItemContent />
</Accordion.Item>
</Accordion.Root>
Props
Root
| Prop | Default | Type |
|---|---|---|
variant | 'outline' | 'outline' | 'plain' |
size | 'md' | 'md' |
collapsible | false | booleanWhether an accordion item can be closed after it has been expanded. |
lazyMount | false | booleanWhether to enable lazy mounting |
multiple | false | booleanWhether multiple accordion items can be expanded at the same time. |
orientation | \vertical\ | 'horizontal' | 'vertical'The orientation of the accordion items. |
unmountOnExit | false | booleanWhether to unmount on exit. |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. | |
defaultValue | string[]The initial value of the expanded accordion items. Use when you don't need to control the value of the accordion. | |
disabled | booleanWhether the accordion items are disabled | |
id | stringThe unique identifier of the machine. | |
ids | Partial<{
root: string
item: (value: string) => string
itemContent: (value: string) => string
itemTrigger: (value: string) => string
}>The ids of the elements in the accordion. Useful for composition. | |
onFocusChange | (details: FocusChangeDetails) => voidThe callback fired when the focused accordion item changes. | |
onValueChange | (details: ValueChangeDetails) => voidThe callback fired when the state of expanded/collapsed accordion items changes. | |
value | string[]The controlled value of the expanded accordion items. |
Item
| Prop | Default | Type |
|---|---|---|
value* | stringThe value of the accordion item. | |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. | |
disabled | booleanWhether the accordion item is disabled. |