Tag Input
The chosen tags inline, then Add tag, which opens a searchable list with a tick on the right of each chosen tag and Create “…” for a new one. Built on ui-sdk's multiple Combobox.
BetaReady to use. Its API can still change in a minor release; the changelog says when.
import { TagInput } from "@leap-crm/design-system";Playground
Change a prop and the component follows. Its code is under Props.
Props
Best practices
When to use it, and the rules that apply in particular places.
| Guidance | Practice |
|---|---|
| Do | Use it to label a record with several of a firm's tags, like Urgent and Referral on an opportunity. |
| Do | Set onCreate only where a person may add to the firm's tags. Add the new tag to options and the value, and return a Promise so its row shows as pending until it saves. |
| Do | Give an option a tone when the colour means something across the firm, like urgent. The tag's text still says it, so colour is never the only signal. |
| Do | Set addLabel and searchLabel to what is being added when the tags have a narrower meaning, like "Add practice area". |
| Don't | Use it to choose records, like the contacts on a matter. Use Combobox with multiple, which searches as you type and shows a second line like an email. |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| options * | TagOption[] | — | Every tag that can be chosen. |
| value | string[] | — | The chosen tags' values. Pass it to control the input. |
| defaultValue | string[] | — | The tags chosen at first, when uncontrolled. |
| onValueChange | (value: string[]) => void | — | Runs with the chosen tags' values whenever one is added or removed. |
| onCreate | (name: string) => unknown | — | Shows a Create "…" row for text that matches no tag, and runs with that text. Add the new tag to `options` and to the value; return a Promise to show the row as pending until it settles. |
| addLabel | string | "Add tag" | The trigger's text. |
| searchLabel | string | "Search tags" | Names the search field in the list. |
| name | string | — | The name the values submit under. |
| disabled | boolean | — | Shows it as unavailable and stops it responding. |
| className | string | — | Classes added to the root element, merged with its own. Tokens only. |
Code
What the playground shows, ready to copy.
import { TagInput } from "@leap-crm/design-system";
<TagInput options={tags} defaultValue={["conveyancing", "urgent"]} />Choosing and creating
Press Add tag and type: arrows move, Enter toggles a tag, Escape closes. Text that matches no tag offers Create. Each tag's × removes it; Backspace does too from the keyboard. A new tag opens its space and turns in; a removed one fades first, then the row closes up behind it.
Empty and disabled
What the examples share
The imports and the scaffolding the examples above call. The scaffolding lives in this page, not in the library.
import { useState } from "react";
import { Field, TagInput, type TagOption } from "@leap-crm/design-system";
const starting: TagOption[] = [
{ value: "conveyancing", label: "Conveyancing", tone: "info" },
{ value: "urgent", label: "Urgent", tone: "warning" },
{ value: "referral", label: "Referral", tone: "purple" },
{ value: "estate", label: "Estate", tone: "teal" },
{ value: "vip", label: "VIP", tone: "yellow" },
];
function TagDemo() {
const [options, setOptions] = useState(starting);
const [value, setValue] = useState(["conveyancing", "urgent", "referral"]);
const create = (name: string) => {
const tag = {
value: name.toLowerCase(),
label: name,
tone: "slate" as const,
};
setOptions(current => [...current, tag]);
setValue(current => [...current, tag.value]);
};
return (
<div className="w-md">
<Field label="Tags">
<TagInput
options={options}
value={value}
onValueChange={setValue}
onCreate={create}
/>
</Field>
</div>
);
}Keyboard
The keys it answers to. Tab moves between components, arrows move within them.
| Keys | What they do |
|---|---|
| Typing | Opens the list with the tags that match. |
| Arrow keys | Move the highlight while focus stays in the input. |
| Enter | Chooses the highlighted tag, or creates one from the text on the create option. |
| Backspace | In an empty input, removes the last tag. |
| Escape | Closes the list and keeps focus in the input. |





