Accordion API

API documentation for Accordion component

AccordionRoot#

Props#

Defines valid properties in Accordion component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: AccordionRootInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: AccordionRootInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<AccordionRootPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: AccordionRootInstance) => ReactNode)
null
The children to render.
lazyboolean
false
When enabled, hidden tabs are not rendered at all. Defaults to false that hides tabs with css.
tabIndexnumber
0
Index of the element in tabbing order.
onValueChange(event: AccordionRootValueChangeEvent) => void
null
Callback fired when the accordion's value changes.
defaultValuestring | number | (string | number)[]
null
Default value of the active panel or an array of values in multiple mode.
valuestring | number | (string | number)[]
null
Value of the active panel or an array of values in multiple mode.
multipleboolean
false
When enabled, multiple tabs can be activated at the same time.
openOnFocusboolean
false
When enabled, the accordion panel will be opened on focus.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

State#

Defines valid state in AccordionRoot component.

nametypedefaultdescription
valuestring | number | (string | number)[]
null
Value of the active panel or an array of values in multiple mode.

Exposes#

Defines the methods and properties exposed by Accordion component.

nametypedefaultdescription
stateuseAccordionState
null
The state of the useAccordion.
updateValue(event: SyntheticEvent, key: string | number) => void
null
The method to update the value of the active panel.
isItemActive(key: string | number) => boolean
null
The method to check if the panel is active.
onTriggerClick(event: MouseEvent<HTMLButtonElement>, value: string | number) => void
null
The method to handle the click event of the accordion trigger.
onTriggerFocus(event: FocusEvent<HTMLButtonElement>, value: string | number) => void
null
The method to handle the focus event of the accordion trigger.
onTriggerKeyDown(event: KeyboardEvent<HTMLButtonElement>, value: string | number) => void
null
The method to handle the key down event of the accordion trigger.

Interfaces#

Defines passthrough(pt) options of Accordion component.

nametypedefaultdescription
rootAccordionRootPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.
panelAccordionRootPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the panel's DOM element.
headerAccordionRootPassThroughType<HTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the header's DOM element.
contentAccordionRootPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the content's DOM element.
headerindicatorAccordionRootPassThroughType<HTMLAttributes<HTMLSpanElement>>
null
Used to pass attributes to the header indicator's DOM element.

Types#

Instance of AccordionRoot component.

values
ComponentInstance<AccordionRootProps, AccordionRootState, AccordionRootExposes>

AccordionPanel#

Props#

Defines valid properties in AccordionPanel component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: AccordionPanelInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: AccordionPanelInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<AccordionPanelPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: AccordionPanelInstance) => ReactNode)
null
The children to render.
valuestring | number
null
Unique value of item.
disabledboolean
false
Whether the item is disabled.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by AccordionPanel component.

nametypedefaultdescription
accordionAccordionRootInstance
null
The Accordion component instance.
activeboolean
null
Whether the item is active.

Interfaces#

Defines passthrough(pt) options of AccordionPanel component.

nametypedefaultdescription
rootAccordionPanelPassThroughType<HTMLAttributes<HTMLSpanElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of AccordionPanel component.

values
ComponentInstance<AccordionPanelProps, AccordionPanelState, AccordionPanelExposes>

AccordionHeader#

Props#

Defines valid properties in AccordionHeader component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: AccordionHeaderInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: AccordionHeaderInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<AccordionHeaderPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: AccordionHeaderInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by AccordionHeader component.

nametypedefaultdescription
accordionAccordionRootInstance
null
The Accordion component instance.
accordionpanelAccordionPanelInstance
null
The AccordionPanel component instance.

Interfaces#

Defines passthrough(pt) options of AccordionHeader component.

nametypedefaultdescription
rootAccordionHeaderPassThroughType<HTMLAttributes<HTMLSpanElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of AccordionHeader component.

values
ComponentInstance<AccordionHeaderProps, AccordionHeaderState, AccordionHeaderExposes>

AccordionHeaderIndicator#

Props#

Exposes#

Interfaces#

Types#

AccordionContent#

Props#

Defines valid properties in AccordionContent component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: AccordionContentInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: AccordionContentInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<AccordionContentPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: AccordionContentInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by AccordionContent component.

nametypedefaultdescription
accordionAccordionRootInstance
null
The Accordion component instance.

Types#

Instance of AccordionContent component.

values
ComponentInstance<AccordionContentProps, AccordionContentState, AccordionContentExposes>