components/progress
Affichage · 23 / 64

Progress

ui.widgets.Progress

Progression déterminée et indéterminée.

BEHAVIOR CONTRACT

Le pourcentage, status, height et l'animation indéterminée forment un seul composant.

RECORDED INTERACTION

Montre 25 / 60 / 100, error et l'état indéterminé.

examples/storybook/stories.zig:617
// ── Progress ──
pub fn buildProgress(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
    const a = cx.allocator;
    const c = try col(cx, 16);
    try c.appendChild(a, try label(cx, "Values 25% / 60% / 100%"));
    try c.appendChild(a, try W.Progress(.{ .value = 25, .width = 320, .show_text = true }).mount(scope, cx));
    try c.appendChild(a, try W.Progress(.{ .value = 60, .width = 320, .show_text = true }).mount(scope, cx));
    try c.appendChild(a, try W.Progress(.{ .value = 100, .width = 320, .status = .success, .show_text = true }).mount(scope, cx));

    try c.appendChild(a, try label(cx, "Heights (2 / 4 / 8 / 12)"));
    inline for (.{ 2, 4, 8, 12 }) |h| {
        try c.appendChild(a, try W.Progress(.{ .value = 50, .width = 320, .height = @as(f32, h) }).mount(scope, cx));
    }

    try c.appendChild(a, try label(cx, "Error / indeterminate / no-text"));
    try c.appendChild(a, try W.Progress(.{ .value = 40, .width = 320, .status = .@"error", .show_text = true }).mount(scope, cx));
    try c.appendChild(a, try W.Progress(.{ .indeterminate = true, .width = 320 }).mount(scope, cx));
    try c.appendChild(a, try W.Progress(.{ .value = 70, .width = 320, .show_text = false }).mount(scope, cx));
    return c;
}
Voir le code sur GitHubexamples/storybook/stories.zig:617

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.

zenit · Double licenceGratuit pour les projets open source sous GPL-3.0-only ; les produits propriétaires ou commerciaux nécessitent une licence commerciale.Contacter l’auteur : zongyi.xzy#gmail.com (remplacez # par @)zenit 5f9add5+wip 2026-09-30