Back to components
ElementForm & InputFree

Repeatable Field Group React component

A set of fields people can repeat: add a row, remove one, drag rows into order. Rows grow in and slide out, focus lands in the new row, Enter in the last row adds another, and min / max limits keep the list in bounds.

About the Repeatable Field Group component

Repeatable Field Group is a form section where people add, edit, remove and reorder rows of the same fields, like a list of teammates to invite with an email and a role each. New rows slide in, removed rows slide out to the side, and rows can be dragged into a new order by their handle while the others make room.

fields describes the columns: each has a key, a label, a type (text, email, number, url or select), an optional placeholder, options for selects, a starting value for new rows and a grow factor for its width. The rows come out of onValueChange as plain objects keyed by field, such as { email, role }. min and max limit the number of rows, and a counter shows how many are used. label, description and addLabel set the texts, and reorderable={false} hides the drag handles.

When to use it

Use Repeatable Field Group when people enter a list of similar things of unknown length: invites, links, phone numbers, line items, key / value pairs, custom fields.

For a list of existing items to sort, use Sortable List. For picking from known options, use Multi Select or Checkbox Group.

Installation

Add the Repeatable Field Group component to your project with the shadcn CLI. It lands in components/repeatable-field-group.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add @reactframe/repeatable-field-group

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install motion clsx tailwind-merge

More Form & Input components

Filter Chips
Free
Dual Range Slider
Free
Icon Action Button
Free
Button Group
Free
Glossy Gradient Button
Free
Toggle Button
Free