TagsInput
ui.widgets.TagsInputSaisir de nombreux tokens au clavier.
BEHAVIOR CONTRACT
La validation par virgule / Entrée, la suppression, le focus et la mise à jour de la liste respectent les limites de graphèmes.
RECORDED INTERACTION
Le harness tape « docs, » qui est validé comme nouveau tag.
// ── 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;
}Le code source tel quel de la story dans le Storybook (zenit 5f9add5+wip 2026-09-30). W désigne ui.widgets ; col / row / label sont de petits helpers de mise en page du Storybook.
TagsInputProps
ui.widgets.TagsInputfn mountTagsInput(props: TagsInputProps, scope: *Scope, cx: *Cx) !TagsInputMountChamp
Type
Défaut
Description
initial_tags[]const []const u8&.{}—
max_tagsusize16—
widthf32360—
placeholder[]const u8"Add tag, end with comma"—
on_change?core.HandlerRefnull—
TagsInputMount
ui.widgets.TagsInputChamp
Type
Défaut
Description
wrapper*Node—
—
state*TagsInputState—
—
input*Node—
—