Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sit esse nisi eligendi fuga! Quas nisi repellat adipisci animi repellendus incidunt laborum sunt qui nesciunt, ducimus saepe sapiente sed ut labore. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sit esse nisi eligendi fuga! Quas nisi repellat adipisci animi repellendus incidunt laborum sunt qui nesciunt, ducimus saepe sapiente sed ut labore.
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sit esse nisi eligendi fuga! Quas nisi repellat adipisci animi repellendus incidunt laborum sunt qui nesciunt, ducimus saepe sapiente sed ut labore. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sit esse nisi eligendi fuga! Quas nisi repellat adipisci animi repellendus incidunt laborum sunt qui nesciunt, ducimus saepe sapiente sed ut labore.
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sit esse nisi eligendi fuga! Quas nisi repellat adipisci animi repellendus incidunt laborum sunt qui nesciunt, ducimus saepe sapiente sed ut labore. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sit esse nisi eligendi fuga! Quas nisi repellat adipisci animi repellendus incidunt laborum sunt qui nesciunt, ducimus saepe sapiente sed ut labore.
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sit esse nisi eligendi fuga! Quas nisi repellat adipisci animi repellendus incidunt laborum sunt qui nesciunt, ducimus saepe sapiente sed ut labore. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sit esse nisi eligendi fuga! Quas nisi repellat adipisci animi repellendus incidunt laborum sunt qui nesciunt, ducimus saepe sapiente sed ut labore.
State
Note that value
and onValueChanged
are optional on the root component.
Content for Item 1
Content for Item 2
Content for Item 3
Collapsible
By default you can’t close open items. Adding collapsible
changes this behavior.
Content for Item 1
Content for Item 2
Content for Item 3
Content for Item 4
Multiple
Adding multiple
allows items to open independently.
Content for Item 1
Content for Item 2
Content for Item 3
Grid Columns
Use Grid Columns to adjust the layout of the Trigger component.
Content for Item 1
Content for Item 2
Content for Item 3
Content for Item 4
API Reference
Root
"w-full grid gap-2"
Property | Default | Type |
---|---|---|
children | - | ReactNode |
element | - | ((arg: { attributes: Record<string, unknown>; }) => Element | null) | undefinedRender the element yourself |
ids | - | Partial<{ root: string; item: (value: string) => string; itemContent: (value: string) => string; itemTrigger: (value: string) => string; }> | undefinedThe ids of the elements in the accordion. Useful for composition. |
multiple | false | boolean | undefinedWhether multiple accordion items can be expanded at the same time. |
collapsible | false | boolean | undefinedWhether an accordion item can be closed after it has been expanded. |
value | - | string[] | undefinedThe controlled value of the expanded accordion items. |
defaultValue | - | string[] | undefinedThe initial value of the expanded accordion items. Use when you don't need to control the value of the accordion. |
disabled | - | boolean | undefinedWhether the accordion items are disabled |
onValueChange | - | ((details: ValueChangeDetails) => void) | undefinedThe callback fired when the state of expanded/collapsed accordion items changes. |
onFocusChange | - | ((details: FocusChangeDetails) => void) | undefinedThe callback fired when the focused accordion item changes. |
orientation | "vertical" | "horizontal" | "vertical" | undefinedThe orientation of the accordion items. |
dir | "ltr" | "ltr" | "rtl" | undefinedThe document's text/writing direction. |
getRootNode | - | (() => ShadowRoot | Node | Document) | undefinedA root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. |
RootContext
Property | Default | Type |
---|---|---|
children | - | (context: AccordionRootContextType) => ReactNode |
Item
"grid gap-2"
Property | Default | Type |
---|---|---|
children | - | ReactNode |
element | - | ((arg: { attributes: Record<string, unknown>; }) => Element | null) | undefinedRender the element yourself |
value | - | stringThe value of the accordion item. |
disabled | - | boolean | undefinedWhether the accordion item is disabled. |
ItemContext
Property | Default | Type |
---|---|---|
children | - | (context: AccordionItemContextType) => ReactNode |
Heading
""
Property | Default | Type |
---|---|---|
level | 3 | 1 | 2 | 3 | 4 | 5 | 6 | undefinedThe level of the heading. |
children | - | ReactNode |
element | - | ((arg: { attributes: Record<string, unknown>; }) => Element | null) | undefinedRender the element yourself |
Trigger
"w-full grid items-center gap-4 py-2 px-4 rounded-base text-left hover:preset-tonal-primary"
Property | Default | Type |
---|---|---|
children | - | ReactNode |
element | - | ((arg: { attributes: Record<string, unknown>; }) => Element | null) | undefinedRender the element yourself |
Indicator
""
Property | Default | Type |
---|---|---|
children | - | ReactNode |
element | - | ((arg: { attributes: Record<string, unknown>; }) => Element | null) | undefinedRender the element yourself |
Content
"py-2 px-4"
Property | Default | Type |
---|---|---|
children | - | ReactNode |
element | - | ((arg: { attributes: Record<string, unknown>; }) => Element | null) | undefinedRender the element yourself |