iced-cube

Layout

Stack

Vertical and horizontal stacks that take their spacing from the theme's scale.

use iced_cube::{hstack, vstack};
use iced_cube::layout::stack::Gap;
API reference
Gaps: Each step of the spacing scale, from Xs to Xl.Gaps: Each step of the spacing scale, from Xs to Xl.
Static preview
Gaps. Each step of the spacing scale, from Xs to Xl.

Usage

Stacks are a thin layer over iced’s column and row. The only difference is that spacing comes from a fixed scale, which keeps gaps consistent across a whole app.

Reach for a plain column or row whenever you need something the stacks do not expose.

Examples

Alignment

Children aligned to the start, centre or end.

Alignment: Children aligned to the start, centre or end.Alignment: Children aligned to the start, centre or end.
Static preview

Wrapping

A horizontal stack that flows onto new lines.

Wrapping: A horizontal stack that flows onto new lines.Wrapping: A horizontal stack that flows onto new lines.
Static preview

API

ItemDescription
vstack(children) / hstack(children)Stacks elements top to bottom or left to right.
.push(element)Adds a child at the end.
.gap(Gap)None, Xs, Sm, Md, Lg or Xl. Defaults to Md.
.align(Alignment)Aligns children across the stack: horizontally in a vstack, vertically in an hstack.
.wrap()Moves children onto a new line when they run out of room.
.padding(padding) / .width(length) / .height(length)Sizing, as on any iced column or row. Without a width or height the stack follows its children: it shrinks to fit, or fills when a child fills.
Gap::pixels()The gap in pixels: 0, 4, 8, 12, 16 or 24.
.len() / .is_empty()How many children the stack has.
Esc