Skip to content

ViewLoader

ViewLoader renders a centered, branded WaveIndicator animation for loading states. It replaces bare Spinner {} usage in views and tab content areas, providing consistent centering and the branded wave animation.

PropTypeDefaultDescription
compactboolfalseUse compact mode for tab or section content areas instead of full-page views.

Default mode fills the available view space with a large wave animation (flex-1 h-full min-h-48, WaveIndicatorSize::Lg).

Compact mode adds vertical padding with a medium wave animation (py-12, WaveIndicatorSize::Md).

Use the default mode when a routed view is waiting for its primary data:

use crate::ui::ViewLoader;
let data = use_resource(|| async move { fetch_items().await });
rsx! {
ViewContainer {
match data.read_unchecked().as_ref() {
Some(Ok(items)) => rsx! {
// Render items
},
Some(Err(e)) => rsx! {
div { class: "text-destructive", "{e}" }
},
None => rsx! {
ViewLoader {}
},
}
}
}

Use compact mode inside tabbed interfaces or sections within a larger page:

match tab_data.read_unchecked().as_ref() {
Some(Ok(data)) => rsx! {
// Render tab content
},
None => rsx! {
ViewLoader { compact: true }
},
}
ScenarioComponent
Page-level data loadingViewLoader {}
Tab or section loadingViewLoader { compact: true }
Button loading stateSpinner {}
Inline chat message loadingSpinner {}
Small inline indicatorsSpinner {}

Use ViewLoader for any loading state that occupies a content region. Keep Spinner for inline or button-adjacent indicators.

ViewLoader wraps WaveIndicator, the branded animation component. WaveIndicator renders five vertical bars that pulse with staggered timing to create a wave effect.

VariantBar widthBar heightUse case
Sm2px8pxInline status indicators
Md3px12pxTab/section loading, chat typing
Lg4px20pxFull-page loading states

You rarely need WaveIndicator directly — ViewLoader handles the common cases. If you need custom layout around the animation:

use crate::ui::{WaveIndicator, WaveIndicatorSize};
rsx! {
div { class: "my-custom-container",
WaveIndicator { size: WaveIndicatorSize::Sm }
}
}
  • src/ui/view_loader_ui.rs — ViewLoader component
  • src/ui/wave_indicator_ui.rs — WaveIndicator component and size enum
  • tailwind.css.assistant-wave-bar animation keyframes