limn
    ↑↓ ChooseEnter OpenEsc Close
    GitHub

    Components/Layout

    SidebarPanel

    The body of a sidebar: its blocks in a column, inset from the edges, on the palette's surface.

    Native componentGuide source

    Preview

    CodeSource
    fn view(state: &State, palette: ComponentPalette) -> Element {
        SidebarPanel::new(
            vec![
                PanelHeader::new("Search", palette).render(),
                SearchField::new("query", &state.query, "Search the project…", palette)
                    .size(ControlSize::Compact)
                    .render(),
                results(state, palette),
            ],
            palette,
        )
        .render()
    }

    SidebarPanel

    The body of a sidebar: its blocks in a column, inset from the edges, on the palette’s surface.

    Import

    use limn::{Component, SidebarPanel};

    Usage

    A panel takes its blocks from top to bottom and the palette. It puts an inset of 6 around them and a gap of 6 between them. It is passive: the blocks report their own actions.

    fn view(state: &State, palette: ComponentPalette) -> Element {
        SidebarPanel::new(
            vec![
                PanelHeader::new("Search", palette).render(),
                SearchField::new("query", &state.query, "Search the project…", palette)
                    .size(ControlSize::Compact)
                    .render(),
                results(state, palette),
            ],
            palette,
        )
        .render()
    }

    A PanelHeader is its usual first block.

    Size

    SidebarPanel::new(blocks, palette).size(320.0, 190.0).render()

    Without size the panel fills whatever holds it. size(width, height) fixes both; a non-finite value leaves that axis to the container.

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