Skip to content
OTF Kit logoOTF Kit

Array Field

Input

Dynamic array form field for repeating row inputs with add / remove controls.

View in Storybook
Array Field
Loading Storybook preview…

Installation

bun add @otfdashkit/ui

Usage

Import Array Field from @otfdashkit/ui.

Code
// Array Field — Dynamic array form field for repeating row inputs with add / remove controls.
//
// Install:
//   bun add @otfdashkit/ui

import { ArrayField } from '@otfdashkit/ui'

export function Example() {
  return (
    <ArrayField>
      {/* your content */}
    </ArrayField>
  )
}

Props

Props declared in the ArrayField source. Inherited HTML attributes are not listed.

PropTypeDefaultDescription
defaultItemrequiredT
onChangerequired(v: T[]) => void
renderItemrequired(item: T, index: number, remove: () => void) => ReactNode
valuerequiredT[]
addLabelstring'Add item'
classNamestring
maxItemsnumber

Related