Module arrange
Expand description
The layout primitives: Stack, Row, Grid, Split, Page, Layers.
The layout primitives (tilolang layout design): Stack, Row, Grid, Split, Page,
Layers, with Scroll and Spacer.
The model apps write against is semantic: children are hug-sized by default, fill the
remaining space by weight, and are bounded in rem, the text size, never in pixels. Gaps are
Rhythm tokens, directions are leading and trailing, and the
adaptive patterns (a responsive grid, a split that collapses, a readable page) are single
primitives with their behaviour built in. The engine is Taffy flexbox and grid; the
arrangement a primitive takes is decided during layout, from the width it is offered.
Constraints flow down and the parent places: a child never reads its own final size.
Structs§
- Arranged
- A container arranged by
L. The primitives are this type with a layout:Stack,Row,Grid,Split,PageandLayers. - Fit
- How a child is sized in each axis, and its aspect ratio.
- Flex
Layout - How a flex container runs.
- Grid
Layout - Layers
Layout - Navigation
- The way a host steers a navigating split from outside it: which pane it shows, and whether it is collapsed to one pane at all. Clones share the state; a host keeps one beside the split, offers the way back where it draws its header, and shows the secondary pane when the person opens something there.
- Page
Layout - Resolved
- What a layout reads of the theme: the
rem, the rhythm gaps and a control’s least side, in logical pixels. - Sizing
- How one axis of a child is sized: as big as its content (
hug), or taking the remaining space by weight (fill), within bounds. - Slot
- A child with how it is sized and placed.
- Space
- What a view reads as
space: the constraint its container offers it (layout.md, “Responding to space”). - Split
Layout - Transcript
Edges - The space a transcript’s list of page rows (
Page::row_after) leaves above its first row and below its last: above, the page’s gutter less the gap the first row has over it, so the first message stands where a page’s first child does; below, nothing, since what follows a transcript (its composer) brings its own spacing, and the newest message sits right above it.
Enums§
- Align
- Placement across a container’s cross axis, or of one item within its cell.
- Arrangement
- How a split arranges its panes.
- At
- One of the nine logical positions of a layer.
- Axis
- The axis of a container’s main direction.
- Collapse
- What a split does when both panes do not fit.
- Columns
- How many columns a grid has.
- Direction
- The direction inline content runs: leading to trailing is left to right for
Ltr. - Distribute
- How a row distributes its children along the main axis.
- Length
- A size in
remor in logical pixels (dp). - Orientation
- The shape of the space a view is offered.
- Pane
- Which pane.
- Side
- The edge the primary pane stands at when side by side.
- Width
Class - The width classes of a view’s container (layout.md, “Responding to space”): in
rem, so enlarged text moves a window to a narrower class.
Constants§
- MEASURE_
REM - The readable width of a page, in
rem.
Traits§
- Layout
- How a primitive arranges its slots. See the module docs.
Functions§
- arrangement_
for - Side by side when both panes’ minimums and the gap between them fit
width. - columns_
for - The number of equal columns of at least
minthat fitwidthwithgapbetween them: as many as fit, and one at least. - page_
content_ width - The content width of a page: at most
measureand at most what is left ofwidthafter a gutter on each side. - rem_of
- One
remin logical pixels: the body text size, text scale included. - scroll
- A vertical scroll view around
child: the constraint on its axis is unbounded, so the child hugs.
Type Aliases§
- Grid
- A responsive grid. Items fill the columns; an item may span several.
- Layers
- Children over each other; the first fills the cell, the others sit at their position.
- Page
- Content bounded to a readable width and centred, with a gutter that scales with the space.
- Row
- Children along the inline direction, mirrored in right-to-left.
gapdefaults torelated,alignto center. - Split
- The adaptive two-pane pattern. Add the primary pane, then the secondary.
- Stack
- Children top to bottom.
gapdefaults tosibling,alignto stretch.