Skip to main content

Steps

Struct Steps 

Source
pub struct Steps { /* private fields */ }
Expand description

A stepped progress indicator.

// Release pipeline: 4 of 6 steps complete, step 5 running.
ui.add(Steps::new(6).current(4));

// Migration failed on step 3.
ui.add(Steps::new(5).current(2).errored(true));

// Onboarding — numbered circles.
ui.add(Steps::new(5).current(2).style(StepsStyle::Numbered));

// Setup wizard — numbered circles with labels and an "in progress"
// hint under the active step.
ui.add(
    Steps::labeled(["Account", "Workspace", "Billing", "Integrations", "Review"])
        .style(StepsStyle::Numbered)
        .current(2)
        .active_sublabel("In progress"),
);

// Horizontal labeled strip — a progress bar with stage names.
ui.add(
    Steps::labeled(["Plan", "Build", "Test", "Deploy"])
        .current(2),
);

// Vertical wizard sidebar.
ui.add(
    Steps::labeled(["Plan", "Design", "Build", "Test", "Deploy"])
        .current(2)
        .vertical(),
);

Implementations§

Source§

impl Steps

Source

pub fn new(total: usize) -> Self

Create a cells-style stepped bar with total steps (clamped to at least 1), all pending.

Source

pub fn labeled(labels: impl IntoIterator<Item = impl Into<String>>) -> Self

Create a StepsStyle::Labeled widget whose step count and labels come from labels. Horizontal by default; call Self::vertical for a wizard-sidebar layout. All steps start pending; add .current(n) to mark the first n as done.

Pair with .style(StepsStyle::Numbered) to render the same labels as captions under numbered circles, an onboarding stepper layout.

Source

pub fn vertical(self) -> Self

Render labeled cells stacked vertically. Only affects StepsStyle::Labeled.

Source

pub fn horizontal(self) -> Self

Render labeled cells arranged horizontally (the default for Steps::labeled). Provided as the explicit counterpart to Self::vertical.

Source

pub fn current(self, current: usize) -> Self

Set how many steps are complete. Clamped to 0..=total.

Source

pub fn errored(self, errored: bool) -> Self

When true, paint the step at current as errored instead of active. No effect when current == total (nothing to error on).

Source

pub fn style(self, style: StepsStyle) -> Self

Pick the visual style. Default: StepsStyle::Cells.

Source

pub fn active_sublabel(self, text: impl Into<String>) -> Self

Caption shown directly under the active step’s label (numbered style with labels only). Useful for stepper-style “In progress” or “Action required” hints. No effect on other styles or when the pipeline has no active step.

Source

pub fn height(self, height: f32) -> Self

Override the cell height (cells style) or dot diameter (numbered style). Defaults: 6 for cells, 22 for numbered.

Source

pub fn desired_width(self, width: f32) -> Self

Override the total width. Defaults to ui.available_width().

Trait Implementations§

Source§

impl Clone for Steps

Source§

fn clone(&self) -> Steps

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Steps

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Widget for Steps

Source§

fn ui(self, ui: &mut Ui) -> Response

Allocate space, interact, paint, and return a Response. Read more

Auto Trait Implementations§

§

impl Freeze for Steps

§

impl RefUnwindSafe for Steps

§

impl Send for Steps

§

impl Sync for Steps

§

impl Unpin for Steps

§

impl UnsafeUnpin for Steps

§

impl UnwindSafe for Steps

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,