SimpleFormIterator

The ready-made row UI for an ArrayInput: add, remove, reorder and a confirmed clear.

Installation

pnpm dlx shadcn@latest add @chelone/simple-form-iterator

The ready-made row UI for an ArrayInput: add, remove, reorder and a confirmed clear.

Props

PropTypeDefaultDescription
addButtonReactElement<IteratorButtonProps, string | JSXElementConstructor<any>>—Replaces the default Add button; it is cloned with the add `onClick`.
childrenReactNode—The inputs repeated in every row.
classNamestring—Extra classes on the iterator root.
disableAddboolean—Hides the Add button.
disableClearboolean—Hides the clear button.
disabledboolean—Hides every control (add, clear, remove, reorder).
disableRemoveboolean | (index: number) => boolean—Hides the remove button, and the clear button with it. A function decides per row index.
disableReorderingboolean—Hides the reorder buttons.
getItemLabelboolean | (index: number) => ReactNode—A label per row. `true` numbers the rows from 1; a function returns the label for a row index; `false` renders none.
inlineboolean—Lays a row's inputs out in one line from the `sm` breakpoint up.
removeButtonReactElement<IteratorButtonProps, string | JSXElementConstructor<any>>—Replaces the default remove button; it is cloned with the remove `onClick`.
reOrderButtonsReactElement<unknown, string | JSXElementConstructor<any>>—Replaces the default reorder buttons; it reads the row via `useIteratorItem`.