use fission::prelude::*;
fission_component! {
pub UploadProgress<()> {
props {
uploaded_bytes: u64,
total_bytes: u64,
}
}
view(upload, _state, cx) {
let fraction = (upload.total_bytes > 0).then(|| {
(upload.uploaded_bytes as f64 / upload.total_bytes as f64)
.clamp(0.0, 1.0) as f32
});
} =>
CircularProgress(
value: fraction,
label: Some(cx.tr("upload.progress")),
motion: CircularProgressMotion::Default,
)
}
Field | Type | Meaning | Notes / default behavior |
|---|---|---|---|
value | Option<f32> | Progress fraction for the ring. | Use Some(0.0..=1.0) for determinate progress. Use None for indeterminate activity. |
id | WidgetId | Retained motion/semantic identity. | Compose supplies structural identity; distinguish repeated indicators. |
size | Option<f32> | Outer width and height of the indicator. | None follows the circular-progress recipe. |
color | Option<Color> | Indicator arc color override. | Defaults to the theme's primary color. |
track_color | Option<Color> | Background track color override. | Defaults to the theme's border color. |
thickness | Option<f32> | Stroke width of the ring. | None follows the circular-progress recipe. |
motion | Option<CircularProgressMotion> | Optional indeterminate rotation. | None is static; choose Default or Spin to animate. |
label | Option<String> | Accessible name for the operation. | Set it even when a nearby caption also explains progress. |