Skip to main content

scrollbar

Function scrollbar 

Source
pub fn scrollbar(
    id: impl Into<SharedString>,
    handle: &ScrollHandle,
    state: &ScrollbarState,
) -> AnyElement
Expand description

The bar: an overlay strip along the right edge of whatever it is laid over, showing nothing at all when the content fits.

Overlay rather than a gutter, so a bar arriving or leaving never reflows the content beneath it.

Its geometry comes from the handle as the last frame left it, which is all a render pass can see; the canvas at the end asks for one more frame when layout disagrees, so the bar is right on the frame after it first appears rather than whenever something else happens to repaint.

No &Theme, unlike most of this crate — a scrollbar is a neutral overlay rather than a toned surface, so the thumb is ink, which already follows the appearance on its own. A parameter it ignored would be worse than none.