limn
    ↑↓ ChooseEnter OpenEsc Close
    GitHub

    Components/Actions

    Link

    A text action that hugs its label: link ink, underlined under the pointer and with keyboard focus, and no hover fill.

    Native componentGuide source

    Preview

    Link

    A text action that hugs its label: link ink, underlined under the pointer and with keyboard focus, and no hover fill.

    Import

    use limn::{Component, Link};

    Usage

    A link needs an ID, a label and the palette. It reports UiAction::Clicked with its ID; the host opens the page or the view.

    fn view(palette: ComponentPalette) -> Element {
        Link::new("docs", "Read the documentation", palette).render()
    }
    
    fn update(state: &mut State, action: &UiAction) {
        if let UiAction::Clicked { id } = action {
            if id == "docs" {
                state.open_docs();
            }
        }
    }

    The ink is palette.link(): a blue in the shade that reads on that palette, dark or light.

    Color

    Link::new("more", "Show more", palette).ink(palette.muted).render()

    ink replaces the link ink with a color of the host’s.

    Size

    Link::new("terms", "Terms", palette).font_size(11.0).render()

    font_size sets the label’s size in pixels. The default is 13.

    Disabled

    Link::new("docs", "Read the documentation", palette).enabled(false).render()

    A disabled link is its label in the palette’s muted, whatever its ink, in the same place. It takes no pointer or focus and reports nothing.

    Actions

    ActionWhen
    UiAction::Clicked { id }The link is activated by pointer, Enter or Space.

    Accessibility

    The platform is told a link named by its label. A disabled link is still there and says it cannot be used.

    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/navigation.rs.