Throbber widget of [ratatui]

NOTE: This crate was originally created as a widget for [tui-rs], so you can see tui:: on the sample code, but (by default) [ratatui] is used, so please replace it accordingly.

throbber-widgets-tui is a [ratatui] (or [tui-rs]) widget that displays throbber.

A throbber may also be called:

Demo

Demo Animation

The demo shown in the gif can be run with all available symbols.

sh cargo run --example demo --release

Features

Getting Started

MSRV: throbber-widgets-tui requires rustc 1.67.0 or newer.

sh cargo add throbber-widgets-tui

Default is [ratatui] as tui.

OR use [tui-rs] instead of [ratatui]. use tui features like clicked here.

sh cargo add throbber-widgets-tui --no-default-features --features tui

Example code:

```rust

[cfg(feature = "ratatui")]

use ratatui as tui; // : // : struct App { throbberstate: throbberwidgetstui::ThrobberState, } impl App { fn ontick(&mut self) { self.throbberstate.calcnext(); } } // : // : fn ui(f: &mut tui::Frame, app: &mut App) { let chunks = tui::layout::Layout::default() .direction(tui::layout::Direction::Horizontal) .margin(1) .constraints( [ tui::layout::Constraint::Percentage(50), tui::layout::Constraint::Percentage(50), ] .as_ref(), ) .split(f.size());

// Simple random step
let simple = throbber_widgets_tui::Throbber::default();
f.render_widget(simple, chunks[0]);

// Set full with state
let full = throbber_widgets_tui::Throbber::default()
    .label("Running...")
    .style(tui::style::Style::default().fg(tui::style::Color::Cyan))
    .throbber_style(tui::style::Style::default().fg(tui::style::Color::Red).add_modifier(tui::style::Modifier::BOLD))
    .throbber_set(throbber_widgets_tui::CLOCK)
    .use_type(throbber_widgets_tui::WhichUse::Spin);
f.render_stateful_widget(full, chunks[1], &mut app.throbber_state);

} ```

Apps using throbber-widgets-tui

Dependencies (By default)

Direct dependencies crates:

sh cargo license --direct-deps-only --avoid-build-deps --avoid-dev-deps | awk -F ":" 'BEGIN {printf "|License|crate|\n|-|-|\n"} {printf "|%s|%s|\n", $1, $2}'

|License|crate| |-|-| |Apache-2.0 OR MIT (1)| rand| |MIT (2)| crossterm, ratatui| |Zlib (1)| throbber-widgets-tui|

Chain dependencies crates:

sh cargo license --avoid-build-deps --avoid-dev-deps | awk -F ":" 'BEGIN {printf "|License|crate|\n|-|-|\n"} {printf "|%s|%s|\n", $1, $2}'

|License|crate| |-|-| |Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT (1)| wasi| |Apache-2.0 OR MIT (35)| bitflags, bitflags, cassowary, cfg-if, getrandom, indoc, libc, lockapi, log, parkinglot, parkinglotcore, paste, ppv-lite86, rand, randchacha, randcore, scopeguard, signal-hook, signal-hook-mio, signal-hook-registry, smallvec, unicode-segmentation, unicode-width, winapi, winapi-i686-pc-windows-gnu, winapi-x8664-pc-windows-gnu, windows-sys, windows-targets, windowsaarch64gnullvm, windowsaarch64msvc, windowsi686gnu, windowsi686msvc, windowsx8664gnu, windowsx8664gnullvm, windowsx8664msvc| |MIT (5)| crossterm, crosstermwinapi, mio, ratatui, redoxsyscall| |Zlib (1)| throbber-widgets-tui|

License

This repository's license is zlib. Please feel free to use this, but no warranty.