# TagInput

Free-form text tokens with keyboard entry, removal and named form values.

Connect Flood once using [the installation guide](https://flood.md/docs/installation). Then import the components you use; no per-component add command is needed.

## Example

```tsx
"use client";

import { FloodRoot, TagInput } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <TagInput label="Topics" defaultValue={["Design", "React"]} name="topics" placeholder="Add a topic…" />
    </FloodRoot>
  );
}
```

## Design notes

- Use TagInput for values the user may create. Use MultiSelect for a fixed option collection.
- Enter and configured delimiters commit trimmed, unique tags. Pasting separated text adds multiple tags. IME composition is preserved.
- Each committed tag submits one entry under name. required applies to committed tags; a draft is not a submitted token. Form reset preserves controlled ownership.
- Backspace on an empty draft removes the last token. Read only preserves copying and form values; disabled omits submission and removal. Introduced in 0.2.7.

## API reference

| Prop | Values | Default |
| --- | --- | --- |
| `status` | `"error" \| "warning" \| "success" \| "info"` | `—` |
| `invalid` | `boolean` | `—` |
| `controlSize` | `"sm" \| "md" \| "lg" \| "xl"` | `"md"` |
| `label` | `string` | `Required` |
| `hideLabel` | `boolean` | `false` |
| `value` | `readonly string[]` | `—` |
| `defaultValue` | `readonly string[]` | `—` |
| `onValueChange` | `(value: string[]) => void` | `—` |
| `delimiters` | `readonly string[]` | `—` |
| `removeLabel` | `string` | `"Remove"` |
| `requiredMessage` | `string` | `"Add at least one tag."` |
| `Native HTML props` | `Omit<InputHTMLAttributes<HTMLInputElement>, "type" \| "value" \| "defaultValue" \| "onChange" \| "children" \| "size">` | `Forwarded` |
