Array Field
InputDynamic array form field for repeating row inputs with add / remove controls.
Array FieldInput · Web
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.
| Prop | Type | Default | Description |
|---|---|---|---|
| defaultItemrequired | T | ||
| onChangerequired | (v: T[]) => void | ||
| renderItemrequired | (item: T, index: number, remove: () => void) => ReactNode | ||
| valuerequired | T[] | ||
| addLabel | string | 'Add item' | |
| className | string | ||
| maxItems | number |