ArrayFrameProps

The props of the array frame structure slot.

The props a registered structure.arrayFrame component receives: the array field, a renderer for each item, the labels of its controls and the operations that change the array. Props the array entry passes under props come on top.

Type parameters

NameDescription
TItemThe type of one item of the array.
TExtraThe props a frame hands to an item's widget through renderItem; none by default.

Example

const ArrayFrame = <TItem,>({ keys, renderItem, add, remove, addLabel, removeLabels }: ArrayFrameProps<TItem>) => (
  <ul>
    {keys.map((key, index) => (
      <li key={key}>
        {renderItem(index)}
        <button type="button" onClick={() => remove(index)}>{removeLabels[index]}</button>
      </li>
    ))}
    <button type="button" onClick={add}>{addLabel}</button>
  </ul>
)

Members

Prop

Type

See also