# Tags input

Labels picked from the values already used. Typing filters them, a near miss puts the fix first, and a new label takes the Create row.

Section: Components / Inputs
Page: https://ui.heyramzi.com/components/tags-input
Import path: `@heyramzi/ui/components/tags-input`

## Import

```ts
import { TagsInput } from "@heyramzi/ui/components/tags-input";
```

## Usage

```svelte
<TagsInput
  value={used}
  options={tools}
  label="Tools"
  labels={{ add: "Add a tool" }}
  onValueChange={(next) => (used = next)}
/>
```

## Demo

```svelte
<script lang="ts">
	import { TagsInput } from "@heyramzi/ui/components/tags-input";

	const tools = ["Airtable", "Docusign", "Make", "QuickBooks", "SharePoint", "Supabase", "Zapier"];
	let used = $state(["Docusign", "SharePoint"]);
</script>

<div class="w-full max-w-sm">
	<TagsInput
		value={used}
		options={tools}
		label="Tools"
		labels={{ add: "Add a tool" }}
		onValueChange={(next) => {
			used = next;
		}}
	/>
</div>
```

## API

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `value` | `readonly string[]` |  | required. The tags. Order is kept. |
| `onValueChange` | `(next: string[]) => void \| Promise<void>` |  | required. Called with the whole next list. Throw to refuse: the list reverts. |
| `options` | `readonly string[]` | `[]` | The labels people pick from. Picking one stores its exact spelling and case. |
| `allowCreate` | `boolean` | `true` | Whether a label that isn't an option may be made, through the "Create" row only. Text close to an option never becomes a label unless that row is chosen. |
| `max` | `number` |  | Most tags the list holds. Past it the input goes away. |
| `free` | `boolean` | `false` | Free typing, no options or menu: Enter, comma, space or Tab adds what's typed, a paste adds every part, and leaving the field keeps the text. |
| `label` | `string` |  | required. Accessible name of the field. |
| `labels` | `Partial<Labels>` |  |  |
| `disabled` | `boolean` | `false` |  |
| `class` | `string` |  |  |
