Content
- Placeholder describes what to add: "Add a type of person or sector".
A text field that turns entries into removable chips.
import { … } from "@brdgapp/ui/components/tag-input"TagInput is a text field that turns what you type into chips: press Enter or a comma to add, × or Backspace to remove. It trims spaces and ignores duplicates. Bridge uses it for "ICP". The usual mistake is using it for a fixed list of choices: that's a menu.
Field. 40px minimum, 8px corners, grows as chips wrap.
Chip. 11px SemiBold pill, blue tint (primary) or gray (muted), with a remove button.
Text box. Where you type; its placeholder shows only when there are no chips.
Type, then press Enter.
ICP
Press Enter or a comma to add. Backspace removes the last one.
| Rest | Hover | Focus | |
|---|---|---|---|
| Blue chips | ClimateHealth | ClimateHealth | ClimateHealth |
| Grey chips | MarketplacesPayments | MarketplacesPayments | MarketplacesPayments |
| Empty |
| State | What happens |
|---|---|
| Focus | Blue border and a soft blue ring around the whole field. |
| Hover | Darker border. |
Do
Explain how to add under the field.Don't
Rely on people guessing that comma adds a chip.ariaLabel, or point a visible <label> at it.| Keys | Action |
|---|---|
| Enter, | Add the typed text. |
| Backspace | In an empty text box: remove the last chip. |
| Tab | Moves through each chip's remove button, then the text box. |
TagInput
The chip field.
| Prop | Type | Default | Description |
|---|---|---|---|
value | string[] | — | The chips. |
onChange | (next: string[]) => void | — | Called with the new list. |
placeholder | string | — | Shown when empty. |
ariaLabel | string | — | The field's name. |
variant | "primary" | "muted" | "primary" | Chip color. |
className | string | — | Layout only. |
…other attributes | id, aria-*, data-*, event handlers | — | Passed to the field. The component's own props win where they overlap. |
What it's built from and where it's used, read from the code. When you change it, check these too.
Where the code still differs from the system. Follow the system, not the gap.
--text-disabled (2:1); the package uses --text-muted.components.md → TagInput; src/components/ui/tag-input.tsx.