Reflex Logo

Intro

Gallery

Hosting

Components

New

Learn

Components

API Reference

Onboarding

Library

/

Datadisplay

/

Progress

Progress is used to display the progress status for a task that takes a long time or consists of several steps.

rx.progress expects the value prop to set the progress value.

rx.vstack(
    rx.progress(value=0),
    rx.progress(value=50),
    rx.progress(value=100),
    gap="1em",
    min_width=["10em", "20em"],
)

For a dynamic progress, you can assign a state variable to the value prop instead of a constant value.

import asyncio


class ProgressState(rx.State):
    value: int = 0

    @rx.background
    async def start_progress(self):
        async with self:
            self.value = 0
        while self.value < 100:
            await asyncio.sleep(0.1)
            async with self:
                self.value += 1


def live_progress():
    return rx.hstack(
        rx.progress(value=ProgressState.value),
        rx.button(
            "Start", on_click=ProgressState.start_progress
        ),
        width="10em",
    )

A progress bar component.

PropTypeDescriptionValues
valueint

The value of the progress bar: "0" to "100"

sizeLiteral

The size of the progress bar: "1" | "2" | "3"

variantLiteral

The variant of the progress bar: "classic" | "surface" | "soft"

color_schemeLiteral

The color theme of the progress bar

high_contrastbool

Whether to render the progress bar with higher contrast color against background

radiusLiteral

Override theme radius for progress bar: "none" | "small" | "medium" | "large" | "full"

durationstr

The duration of the progress bar animation. Once the duration times out, the progress bar will start an indeterminate animation.

Event Triggers

See the full list of default event triggers
← MomentScrollArea →

Did you find this useful?

HomeGalleryChangelogIntroductionHosting