limn
    ↑↓ ChooseEnter OpenEsc Close
    GitHub

    Components/States

    TextShimmer

    A line of text with a highlight moving across it, for work in progress that has a name: "Reading files", "Thinking".

    Native componentGuide source

    Preview

    CodeSource
    fn view(state: &State, palette: ComponentPalette) -> Element {
        TextShimmer::new("request-status", &state.status, palette).render()
    }

    Examples

    Each one is the library drawing it. Press, type and hover.

    Text shimmer2 / 2
    CodeSource
    row(vec![TextShimmer::new("loading-shimmer-ink", "Waiting for the build", palette)
        .colors(palette.muted, AlertColors::for_tone(AlertTone::Info, palette).accent)
        .render()])

    TextShimmer

    A line of text with a highlight moving across it, for work in progress that has a name: “Reading files”, “Thinking”.

    Import

    use limn::{Component, TextShimmer};

    Usage

    A shimmer needs an ID, its text and the palette. Reuse the ID while rebuilding the tree, so the highlight does not start again.

    fn view(state: &State, palette: ComponentPalette) -> Element {
        TextShimmer::new("request-status", &state.status, palette).render()
    }

    The text is muted and the highlight is the palette’s text color. It is 13 px sans text, takes no focus and reports nothing. The text can be selected and copied like any other.

    Colors

    TextShimmer::new("build-status", "Waiting for the build", palette)
        .colors(palette.muted, accent)
        .render()

    colors(base, highlight) sets the color of the text and of the highlight that passes over it.

    Motion

    The highlight is paint only: the text is laid out once and does not move. With reduced motion the highlight does not move and nothing repaints, and a shimmer scrolled out of view does not repaint either.

    API reference

    The guide covers composition, options and actions. Generate the complete Rust type and builder reference from the checkout:

    cargo doc -p limn --open

    Component API overview · State and actions

    The example is drawn by crates/limn-gallery/src/pages/loading.rs.