TagsInput
ui.widgets.TagsInput키보드로 여러 token을 연속 입력합니다.
BEHAVIOR CONTRACT
쉼표 / Enter 확정, 삭제, 포커스, tag 목록 갱신이 모두 자소 경계를 안전하게 지킵니다.
RECORDED INTERACTION
harness가 “docs,”를 입력하면 새 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;
}Storybook에 있는 이 story의 원본 코드입니다(zenit 5f9add5+wip 2026-09-30). W는 ui.widgets이며, col / row / label은 Storybook 내부의 작은 레이아웃 헬퍼입니다.
TagsInputProps
ui.widgets.TagsInputfn mountTagsInput(props: TagsInputProps, scope: *Scope, cx: *Cx) !TagsInputMount필드
타입
기본값
설명
initial_tags[]const []const u8&.{}—
max_tagsusize16—
widthf32360—
placeholder[]const u8"Add tag, end with comma"—
on_change?core.HandlerRefnull—
TagsInputMount
ui.widgets.TagsInput필드
타입
기본값
설명
wrapper*Node—
—
state*TagsInputState—
—
input*Node—
—