TagsInput
ui.widgets.TagsInputIntroduce muchos tokens desde el teclado.
BEHAVIOR CONTRACT
La confirmación con coma / Enter, el borrado, el foco y las actualizaciones de la lista respetan los límites de grafema.
RECORDED INTERACTION
El harness escribe “docs,” y se confirma como una etiqueta nueva.
// ── 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;
}El código literal de la story en el Storybook (zenit 5f9add5+wip 2026-09-30). W es ui.widgets; col / row / label son pequeños helpers de layout del Storybook.
TagsInputProps
ui.widgets.TagsInputfn mountTagsInput(props: TagsInputProps, scope: *Scope, cx: *Cx) !TagsInputMountCampo
Tipo
Predeterminado
Descripción
initial_tags[]const []const u8&.{}—
max_tagsusize16—
widthf32360—
placeholder[]const u8"Add tag, end with comma"—
on_change?core.HandlerRefnull—
TagsInputMount
ui.widgets.TagsInputCampo
Tipo
Predeterminado
Descripción
wrapper*Node—
—
state*TagsInputState—
—
input*Node—
—