Skip to main content

useAccordionProvider

Parameter object

PropTypeDescription
allowMultiplebooleanAllow multiple accordion items to expand at once.
initialEnteredbooleanMake all accordion items expanded when initially mounted.
mountOnEnterbooleanLazily mount children of accordion items until they are expanded. Use this option if you don't need to server-side render accordion item contents.
unmountOnExitbooleanUnmount children of accordion items after they are collapsed.
transitionView on GitHubEnable or disable transition. Accept a single boolean value or each individual transition stage in an object.
transitionTimeoutView on GitHubSet transition duration. Accept a single number or individual "enter" or "exit" stage in an object.
onStateChange(event: { key: ItemKey; current: TransitionState }) => voidEvent to notify state changes in any accordion items.

Return object

PropTypeDescription
toggle(key: ItemKey, toEnter?: boolean) => voidA function to toggle item state by providing an item key.
toggleAll(toEnter?: boolean ) => voidA function to toggle all item states at the same time.
NOTE

The return object contains some other properties which are considered implementation details and should not be used externally.