Skip to main content

Module placeholder

Module placeholder 

Source
Expand description

Placeholders: skeletons standing in for content that fills progressively (a metadata panel, a queue’s rows, parameters while they load), and empty states saying why a place is empty and what to do about it.

  • Skeleton: grey shapes in the content’s layout (the kit’s skeleton) with a shimmer crossing them (skeleton-shimmer, in motion.skeleton.shimmer); no shimmer under reduced motion, nor under a given motion clock (tests). Its region carries AccessKit’s busy flag and the name “Loading”, so assistive technologies wait for the content rather than read grey boxes. Not for thumbnails: use what is known (an embedded preview, an average colour) instead;
  • EmptyState: an icon, a title, a sentence and an optional action; EmptyState::show says whether the action was clicked (the application runs its command).
use egui_pop_core::icon::Icon;
use egui_pop_core::placeholder::{EmptyState, Skeleton};

fn ui(ui: &mut egui::Ui, loaded: bool, images: usize) {
    if !loaded {
        ui.add(Skeleton::rows(4));
    } else if images == 0 {
        let import = EmptyState::new(Icon::Folder, "No images in this folder")
            .text("Import images to see them here.")
            .action("Import images")
            .show(ui);
        let _ = import;
    }
}

Structs§

EmptyState
An empty place: an icon, a title, a sentence, an action.
Skeleton
Grey shapes standing in for content.
SkeletonTokens
The skeleton colours of the installed kit, for what stands in for content without being a skeleton (a thumbnail not loaded yet).