List Paste

Splits a pasted list of emails or names, counts valid, duplicate and invalid items, and removes the bad ones before you import or invite.

StopsMessy pasted list imported

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/list-paste.json

The files land in your project. They're yours to edit.

Usage

list-paste-usage.tsx
import { ListPaste } from "@/components/ui/list-paste"

<ListPaste label="Invite teammates" defaultValue={pasted} onImport={setSent} importLabel="Send {count} invites" />

What it catches

  • Items split wrongly by commas inside quoted names
  • Duplicates, by a compare key you choose
  • Invalid items with their line and reason
  • Invisible characters and Name <email> wrappers stripped

Props

ListPaste props
PropTypeDefault
label

Visible label.

string"Paste a list"
value

Controlled text.

string—
defaultValue

Initial text when uncontrolled.

string""
onValueChange

Called with the text on every change, including one-tap clean-ups.

(value: string) => void—
validate

Checks one item. Defaults to an email check.

ListValidatoremailValidator
compareKey

Maps an item to the key used to spot duplicates. Defaults to lowercase.

(value: string) => string—
onImport

Receives the valid, de-duplicated items. Omit to hide the import button.

(items: string[]) => void—
maxProblems

Most problem lines listed before "and N more".

number4
importLabel

Import button label; `{count}` is filled in.

string"Import {count}"
validLabel

Count labels; `{count}` is filled in and `(s)` is dropped for one.

string"{count} valid"
duplicatesLabel

Label of the duplicate count.

string"{count} duplicate(s)"
invalidLabel

Label of the invalid count.

string"{count} invalid"
removeLabel

Label of the one-tap clean-up buttons.

string"Remove"
undoLabel

Label of the button that restores the text before a clean-up.

string"Undo"

* required. Also accepts the native props of <textarea> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Visible label; textarea is described by a polite summary region
  • Remove buttons have aria-labels with the count they remove
  • Undo is a real button; icons are aria-hidden

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

  • Default email check is pragmatic (one @, dotted domain, no spaces), not full RFC 5322 or a deliverability check
  • Shows only the first problems (maxProblems)

What it stops

Messy pasted list imported

Also known as

bulk invite · paste emails · invite members · list import · csv paste · comma separated · team invite · recipients

Field type

Dependencies

Pairs well with