Skip to main content

Module layout

Module layout 

Source
Expand description

Layout attributes: Length, ItemStyle and ContainerStyle.

These are the types every element accepts as layout props. They exist so that rsx! can hand string literals (justify="space-between") and numbers (gap={8}) straight to a setter, and so that the conversion to [taffy::Style] lives in one place.

How a box looks rides along in the same prop: ItemStyle::paint is a PaintStyle, with forwarding setters (bg, border, radius, …), so no element signature changes to gain a background. Only the border reaches taffy — the layout has to reserve the width of the stroke — and the engine paints the rest once the layout is solved.

Re-exports§

pub use crate::paint::PaintStyle;

Structs§

ContainerStyle
The layout attributes of a container (<View>), as a flex/grid parent.
Gap
The gap prop of a container: one value for both axes, or one per axis.
ItemStyle
The layout attributes every element accepts, as a flex/grid item.

Enums§

Align
align-items / align-self. Normal leaves it unset.
Direction
flex-direction.
Display
display.
Justify
justify-content / align-content. Normal leaves it unset.
Length
A length in a layout attribute.

Functions§

root_style
The taffy style of the root container: a column that fills the window.

Type Aliases§

AlignSelf
align-self, which taffy spells with the same type as align-items.