Progress
Show a changing value with an eased, CSS-styled progress bar.

use blinc_cn::{ButtonVariant, button, progress};
use blinc_core::reactive::{Signal, computed};
use blinc_layout::{binding::IntoReactive, prelude::*};
pub fn progress_demo(value: Signal<f32>, disabled: Signal<bool>, viewport: (f32, f32)) -> Div {
div()
.class("demo-stack")
.class("demo-stack--center")
.child(text("Uploading your project").class("demo-label"))
.child(progress(value).w((viewport.0 - 48.0).clamp(1.0, 256.0)))
.child(
bound_text(computed(move |graph| {
format!("{:.0}% complete", graph.get(value).unwrap_or(0.0))
}))
.class("demo-caption"),
)
.child(
button("Advance")
.variant(ButtonVariant::Outline)
.disabled(disabled)
.on_click(move |_| value.set((value.get() + 10.0).min(100.0)))
.build_component()
.id("demo-action"),
)
}
fn bound_text(value: impl IntoReactive<String>) -> Text {
Text::bound(value.into_reactive())
}
@layer components {
.cn-progress {
font-family: var(--font-sans);
}
.cn-progress {
background: var(--cn-progress-track, var(--border));
border-radius: var(--radius-full);
}
.cn-progress-bar {
background: var(--cn-progress-bar, var(--primary));
border-radius: var(--radius-full);
transition: flex-grow var(--duration-slow) var(--ease-nav);
}
@keyframes cn-progress-pulse {
from {
opacity: 0.35;
}
to {
opacity: 1;
}
}
.cn-progress[data-indeterminate] > .cn-progress-bar {
animation: cn-progress-pulse var(--duration-slowest) var(--ease-in-out) infinite alternate;
}
}
Usage and properties
Bind a value, Signal or Computed. Progress does not own a task or timer; application state supplies the percentage. Use progress_indeterminate() when no percentage is available.
Use the installation guide to add blinc_cn and its component stylesheet. Create the fixture bindings once, and return the demo from your UI builder. Values marked Bound accept Signal/Computed sources where the API supports them; structural options configure the component at construction.
| Property | Type | Update model | This example |
|---|---|---|---|
value | f32 | Bound | 42 (0–100) |
size | ProgressSize | Structural | Medium |
w | f32 | Structural | Container width, up to 256 logical pixels |
progress_indeterminate() | Builder | Structural alternative | Not used in this example |
Keyboard and interaction
[data-indeterminate] on the track enables the indeterminate animation. A progress bar is informational and is not a keyboard stop; the example button advances it.
Customizing it
Add application CSS after the default component layer. These selectors are the restyling surface for this component:
.cn-progress.cn-progress-bar.demo-caption
Theme and component variables: --cn-progress-track, --cn-progress-bar, --border, --primary, --radius-full, --duration-slow, --ease-nav.
Built-in themes
The Live theme control installs Blinc's own theme bundles, including their colours, focus rings, corner shapes and motion tokens.
pub fn theme_bundle_for(name: &str) -> blinc_theme::ThemeBundle {
match name {
"restrained" => blinc_theme::RestrainedTheme::bundle(),
"expressive" => blinc_theme::ExpressiveTheme::bundle(),
_ => blinc_theme::HybridTheme::bundle(),
}
.with_css(blinc_cn::cn_styles::CN_STYLES)
}Download the default widget and component stylesheets. Sample assets and licenses are available in the asset guide.
Documentation
From the canonical component guide.
Values are in the 0..=100 range:
progress(75.0)
Bound to a Signal
An f32, Signal<f32> or Computed<f32> can drive the bar. Bound values
change in place and ease by the transition on .cn-progress-bar:
let pct = ctx.use_signal(0.0_f32);
div()
.child(progress(pct).w(300.0))
.child(button("Advance").on_click(move |_| {
pct.update(|value| (value + 10.0).min(100.0));
}))
Indeterminate
For work of unknown length:
progress_indeterminate().w(300.0)
The track is .cn-progress, with data-size and, when applicable,
data-indeterminate. The bar is .cn-progress-bar. Their colours read
--cn-progress-track and --cn-progress-bar; the transition and
cn-progress-pulse keyframes control motion.
With a Label
use blinc::core::reactive::computed;
let pct = ctx.use_signal(0.0_f32);
let shown = computed(move |graph| format!("{}%", graph.get(pct).unwrap_or(0.0) as i32));
div().flex_col().gap(1.0)
.child(div().flex_row().justify_between()
.child(label("Uploading"))
.child(label(shown)))
.child(progress(pct))
Platforms and version
The component API is available in Blinc 0.6.0. The Live example runs in a dedicated worker and requires a compatible GPU surface. Preview and Code remain available when Live cannot start. The canvas has a descriptive label; a full screen-reader DOM mirror is not provided. The gallery integration is based on revision e2e55c24e078.
Recordings and live demos use the default Hybrid theme with bundled Noto Sans. The recording uses a 560 × 320 logical viewport at twice that resolution. Live follows its container and actual display density. Source base revision · Exact build source · Artifact versions and checksums · Font license.