Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Array Fields Domain List Form Block for Radix UI

An allowed sign-up domains list: one text field per row, Add and Remove, Enter to append, pasting a list to split it into rows, each row checked as a domain with repeats named, and an empty state for no limit.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Edit a list of values without losing your place, with this array fields form for React with Radix UI. A compact header sits over a hairline frame with a plus mark on each corner. A band heading counts the rows ("3 of 10"); each row is one domain in an Input with a Remove button, up to ten. Add domain, or Enter in the last row, appends a row and focuses it; Enter in any other row moves to the next. Pasting several domains separated by lines, commas or spaces splits them into rows. Each row is checked as a domain and a repeat is flagged by name, in a line that is always reserved under the row. Remove moves focus to the row before it, or to Add. With no rows an Empty state says any email domain can sign up, and Save says so too. Save domains names the first problem and focuses it. The Shine Button is the only colored control. It's built from Input, Button, Empty, Shine Button and Guides, with a CSS entrance only. For allow lists, redirect URLs, IP ranges and any list of single values.

FAQ

What does pasting do?

If the text holds two or more values separated by whitespace, commas or semicolons, the browser's paste is cancelled and the values become rows: the first fills the current row if it is empty, the rest follow it. Values past the tenth are dropped and the foot says how many were kept. A single value pastes normally.

Where does focus go?

Add focuses the new row's field, Enter in the last row adds a row, and Remove moves focus to the previous row or to Add, so a keyboard user never lands on the page. The foot's polite line says what happened, such as "Domain 3 added."

How is a domain checked?

Values are trimmed and lower-cased, then matched against a plain domain pattern (labels of letters, digits and hyphens, a dot, a top-level part of two letters or more). A repeat of an earlier row is named in the row's line. Empty rows are only a problem when you press Save.

How does it look on a phone?

The same single column: each row is a field and a Remove button, and the foot is pinned to the bottom with Save domains at full width.

What stays local, and how do I connect it for real?

Nothing is saved: the foot says "in this demo". To make it real, post the list from the submit handler, check it again on the server (a domain pattern is not proof of ownership) and show the answer in the status line.

How do I connect it to react-hook-form or TanStack Form?

With react-hook-form, replace the rows state with useFieldArray and keep the paste handler calling replace; messageOf becomes a resolver on the array.