Skip to main content

Crate tui_skeleton

Crate tui_skeleton 

Source
Expand description

Animated skeleton loading widgets for Ratatui.

Provides placeholder widgets that pulse, sweep, or shimmer while data loads. All widgets are stateless — pass elapsed_ms from your event loop and the animation state is computed purely from the timestamp.

§Widgets

§Example

use tui_skeleton::{SkeletonBlock, AnimationMode, Color};

let elapsed_ms = 1000u64;
let widget = SkeletonBlock::new(elapsed_ms)
    .mode(AnimationMode::Breathe)
    .base(Color::Rgb(30, 22, 58))
    .highlight(Color::Rgb(49, 40, 78));

§Adaptive Tick Rate

Skeleton animations look best at ~20 FPS (TICK_ANIMATED) but most TUI applications tick at ~5 FPS (TICK_IDLE) for static content. The recommended pattern:

  1. Track whether any skeleton widget is currently visible
  2. Use TICK_ANIMATED when skeletons are on screen
  3. Revert to TICK_IDLE when all data has loaded

This keeps CPU usage low while delivering smooth animations during loading.

Re-exports§

pub use bar_chart::SkeletonBarChart;
pub use block::SkeletonBlock;
pub use hbar_chart::SkeletonHBarChart;
pub use kv_table::SkeletonKvTable;
pub use line_chart::SkeletonLineChart;
pub use list::SkeletonList;
pub use streaming_text::SkeletonStreamingText;
pub use table::SkeletonTable;
pub use text::SkeletonText;

Modules§

bar_chart
block
defaults
Default colors that work on both dark and light terminals.
hbar_chart
kv_table
line_chart
list
streaming_text
table
text

Structs§

Block
A widget that renders borders, titles, and padding around other widgets.

Enums§

AnimationMode
Animation style for skeleton loading widgets.
Color
ANSI Color
Constraint
A constraint that defines the size of a layout element.

Constants§

TICK_ANIMATED
Recommended tick interval when skeleton widgets are visible (50ms / 20 FPS).
TICK_IDLE
Recommended tick interval for static content (200ms / 5 FPS).