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.
Parameters
Section titled “Parameters”defaultOpen
Section titled “defaultOpen”boolean
Open state when nothing is stored for storeKey.
storeKey
Section titled “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.
Returns
Section titled “Returns”handleValueChange
Section titled “handleValueChange”handleValueChange: (
value) =>void
Handler for
Parameters
Section titled “Parameters”string[]
Returns
Section titled “Returns”void
itemValue
Section titled “itemValue”itemValue:
string
Value for
openItems
Section titled “openItems”openItems:
string[]
Value for