Layout Decision Tree
Rezi has a “simple first” layout philosophy: fixed and flex layouts stay simple; constraints are for relational/derived rules.
Rezi has a “simple first” layout philosophy: fixed and flex layouts stay simple; constraints are for relational/derived rules.
Decision tree
Need to set a size?
-
Fixed cells
- Use:
width: 24,height: 3 - Avoid:
expr("24")
- Use:
-
Share space with siblings
- Use:
flex: 1(andflexShrink/flexBasiswhen needed) - Avoid: manual
parent.w / nmath in view code
- Use:
-
Smooth scaling with viewport
- Use:
fluid(min, max, options?)
- Use:
-
Derived relationships (relational intent)
- Use helper constraints (preferred):
visibilityConstraints.*widthConstraints.*heightConstraints.*spaceConstraints.*groupConstraints.*conditionalConstraints.*
- Use
expr("...")when helpers don’t express the rule
- Use helper constraints (preferred):
-
2D arrangement
- Use:
ui.grid({ columns: number | string, ... }) - For responsive columns in alpha: compose multiple grids and switch via
display
- Use:
Visibility rule of thumb
- Layout/viewport visibility on supported layout widgets →
display: ...constraint - Business logic visibility →
show(...)/when(...)/maybe(...)/match(...)
Links
docs/guide/constraints.mddocs/reference/constraints-api.mddocs/reference/constraint-expressions.mddocs/guide/constraint-recipes.md
Layout
Rezi uses a cell-based layout system: all sizes and coordinates are measured in terminal character cells (not pixels). This makes layout deterministic across platforms and terminal emulators.
Constraints Guide
Rezi's helper-first constraints API is the canonical way to express derived layout relationships in the alpha branch. Use expr("...") as an advanced escape hatch when helper primitives do not cover...