Skip to content

useAccordionDndState

useAccordionDndState(props): object

Defined in: packages/react/src/ui/dnd/useAccordionDndState.ts:22

Open/closed state for a single-item accordion (a group() field) that follows its item through reorders and survives remounts.

The accordion item’s value is a per-instance constant (useId), never an index-derived string — a reordered array item keeps its component (it is keyed by the item’s stored id), so its open state simply stays with it. The state is also mirrored into DndProvider’s accordionStateRef under storeKey, so a remount (the edit view swapping scrollers when the live preview toggles) restores it.

boolean

Open state when nothing is stored for storeKey.

string

Identity of this accordion that survives reorders — for a group inside an array item, the item’s stored id plus the group’s path below the item; otherwise the field name.

handleValueChange: (value) => void

Handler for

string[]

void

itemValue: string

Value for

openItems: string[]

Value for