---
title: "TagsInput component | zenit Zig UI"
description: "Enter many tokens from the keyboard. Comma / Enter commit, delete, focus and list updates all land on grapheme-safe boundaries."
url: https://ui.surf/zenit/components/tags
language: en
alternate_zh: https://ui.surf/zenit/zh/components/tags.md
alternate_es: https://ui.surf/zenit/es/components/tags.md
alternate_ja: https://ui.surf/zenit/ja/components/tags.md
alternate_ko: https://ui.surf/zenit/ko/components/tags.md
alternate_fr: https://ui.surf/zenit/fr/components/tags.md
alternate_de: https://ui.surf/zenit/de/components/tags.md
project: zenit v0.1.0-alpha (Zig 0.15.2, macOS)
source: https://github.com/version-next/zenit
---

# TagsInput

`ui.widgets.TagsInput`

Enter many tokens from the keyboard.

[Video](https://ui.surf/zenit/media/stories/tags.mp4?v=85989d0ec2)

**BEHAVIOR CONTRACT**

Comma / Enter commit, delete, focus and list updates all land on grapheme-safe boundaries.

**RECORDED INTERACTION**

The harness types “docs,” and it commits as a new tag.

`examples/storybook/stories.zig:3042`

```zig
// ── TagsInput ──
pub fn buildTagsInput(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
    const a = cx.allocator;
    const c = try col(cx, 12);
    const ti = try ui.widgets.TagsInput(.{
        .initial_tags = &.{ "zig", "metal" },
        .width = 380,
    }, scope, cx);
    ti.input.meta.ownership.meta.test_id = "story.tags.input";
    ti.wrapper.meta.ownership.meta.test_id = "story.tags.wrapper";
    try c.appendChild(a, ti.wrapper);
    try c.appendChild(a, try label(cx, "End with comma (or click Add) to commit a tag."));
    return c;
}
```

[View source on GitHubexamples/storybook/stories.zig:3042](https://github.com/version-next/zenit/blob/HEAD/examples/storybook/stories.zig#L3042)

The story's verbatim source from the Storybook (zenit 4c50245 2026-10-01). `W` is `ui.widgets`; `col` / `row` / `label` are small Storybook layout helpers.

### TagsInputProps

`ui.widgets.TagsInput`

[src/ui/components/tags\_input/mod.zig:21](https://github.com/version-next/zenit/blob/HEAD/src/ui/components/tags_input/mod.zig#L21)

```zig
fn mountTagsInput(props: TagsInputProps, scope: *Scope, cx: *Cx) !TagsInputMount
```

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `initial_tags` | `[]const []const u8` | `&.{}` | — |
| `max_tags` | `usize` | `16` | — |
| `width` | `f32` | `360` | — |
| `placeholder` | `[]const u8` | `"Add tag, end with comma"` | — |
| `on_change` | `?core.HandlerRef` | `null` | — |

### TagsInputMount

`ui.widgets.TagsInput`

[src/ui/components/tags\_input/mod.zig:229](https://github.com/version-next/zenit/blob/HEAD/src/ui/components/tags_input/mod.zig#L229)

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `wrapper` | `*Node` | — | — |
| `state` | `*TagsInputState` | — | — |
| `input` | `*Node` | — | — |
