iced-cube

Layout

Scroll area

A scrollable region with a thin, rounded scrollbar that follows the theme.

use iced_cube::scroll_area;
use iced_cube::primitives::scroll_area::Direction;
API reference
Vertical: A long list inside a fixed height.Vertical: A long list inside a fixed height.
Static preview
Vertical. A long list inside a fixed height.

Usage

A scroll area only scrolls when its content is larger than the space it is given, so set a height for vertical scrolling and a width for horizontal scrolling.

In a single direction the scrollbar sits beside the content and never covers it. When scrolling both ways the two scrollbars float over the right and bottom edges, so leave a little padding there.

The mouse wheel, trackpad and dragging the scrollbar all work as usual.

Examples

Horizontal

A row of cards wider than its container.

Horizontal: A row of cards wider than its container.Horizontal: A row of cards wider than its container.
Static preview

Both directions

A grid that overflows both ways.

Both directions: A grid that overflows both ways.Both directions: A grid that overflows both ways.
Static preview

API

ItemDescription
scroll_area(content)Wraps content in a vertically scrolling area.
.direction(Direction)Vertical, Horizontal or Both. Defaults to Vertical.
.width(length) / .height(length)Sets the size of the visible region. Give the scrolling axis a fixed or fill length.
.id(id)Sets the widget id, so the area can be scrolled with iced's scrolling tasks.
Esc