components/icons
데이터 표시 · 34 / 64

Icons

ui.system_icons

프로바이더에 독립적인 시맨틱 아이콘 역할, 크기, 색조.

BEHAVIOR CONTRACT

컴포넌트는 system_icons 역할에만 의존하므로 아이콘 프로바이더를 바꿔도 컴포넌트 API는 바뀌지 않습니다.

RECORDED INTERACTION

가상 커서가 역할, 크기, tint를 훑습니다.

examples/storybook/stories.zig:3196
pub fn buildIconGallery(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
    const a = cx.allocator;
    const c = try col(cx, 12);
    try c.appendChild(a, try label(cx, "System icon contract (provider-neutral subset)"));

    // wrap 成多行网格:每行 6 个。
    var current_row = try row(cx, 8);
    var in_row: usize = 0;
    inline for (GALLERY_ICONS) |spec| {
        if (in_row == 6) {
            try c.appendChild(a, current_row);
            current_row = try row(cx, 8);
            in_row = 0;
        }
        try current_row.appendChild(a, try iconCell(scope, cx, spec.asset, spec.name));
        in_row += 1;
    }
    try c.appendChild(a, current_row);

    // 尺寸 + tint 演示行
    try c.appendChild(a, try label(cx, "Sizes & tints"));
    const demo = try row(cx, 16);
    inline for (.{ 16, 24, 32, 48 }) |sz| {
        try demo.appendChild(a, try ui.iconTint(cx, ui.system_icons.alert, light.color.fg_secondary, .{
            .width = .{ .px = @as(f32, sz) },
            .height = .{ .px = @as(f32, sz) },
        }));
    }
    try demo.appendChild(a, try ui.iconTint(cx, ui.system_icons.heart, .{ .r = 220, .g = 40, .b = 60, .a = 255 }, .{
        .width = .{ .px = 32 },
        .height = .{ .px = 32 },
    }));
    try c.appendChild(a, demo);
    return c;
}
GitHub에서 소스 보기examples/storybook/stories.zig:3196

Storybook에 있는 이 story의 원본 코드입니다(zenit 5f9add5+wip 2026-09-30). W는 ui.widgets이며, col / row / label은 Storybook 내부의 작은 레이아웃 헬퍼입니다.

zenit · 이중 라이선스오픈 소스 프로젝트는 GPL-3.0-only로 무료 사용할 수 있으며, 비공개 소스나 상용 제품에는 상용 라이선스가 필요합니다.작성자 연락처: zongyi.xzy#gmail.com (#을 @로 바꾸세요)zenit 5f9add5+wip 2026-09-30