Skip to main content
OpenTUI uses Yoga Layout (v3.2.1) for flexbox-based layout calculations. All layout properties are available on renderable components through the LayoutOptions interface.

Flex Container Properties

FlexDirectionString
default:"column"
Defines the main axis direction of flex items.Values: "column" | "column-reverse" | "row" | "row-reverse"
WrapString
default:"no-wrap"
Controls whether flex items wrap to multiple lines.Values: "no-wrap" | "wrap" | "wrap-reverse"
AlignString
default:"stretch"
Aligns flex items along the cross axis.Values: "auto" | "flex-start" | "center" | "flex-end" | "stretch" | "baseline" | "space-between" | "space-around" | "space-evenly"
JustifyString
default:"flex-start"
Aligns flex items along the main axis.Values: "flex-start" | "center" | "flex-end" | "space-between" | "space-around" | "space-evenly"

Flex Item Properties

number
default:"0"
Defines how much a flex item should grow relative to siblings.
number
default:"1"
Defines how much a flex item should shrink relative to siblings.Note: Defaults to 0 when explicit width or height is set.
number | 'auto'
default:"auto"
Defines the default size of a flex item before remaining space is distributed.
AlignString
default:"auto"
Overrides the parent’s alignItems for this specific item.Values: "auto" | "flex-start" | "center" | "flex-end" | "stretch" | "baseline" | "space-between" | "space-around" | "space-evenly"

Size Properties

number | 'auto' | `${number}%`
default:"auto"
Sets the width of the component.
number | 'auto' | `${number}%`
default:"auto"
Sets the height of the component.
number | 'auto' | `${number}%`
Sets the minimum width constraint.
number | 'auto' | `${number}%`
Sets the minimum height constraint.
number | 'auto' | `${number}%`
Sets the maximum width constraint.
number | 'auto' | `${number}%`
Sets the maximum height constraint.

Position Properties

PositionTypeString
default:"relative"
Defines the positioning type of the component.Values: "static" | "relative" | "absolute"
number | 'auto' | `${number}%`
Sets the top position offset.
number | 'auto' | `${number}%`
Sets the right position offset.
number | 'auto' | `${number}%`
Sets the bottom position offset.
number | 'auto' | `${number}%`
Sets the left position offset.

Spacing Properties

Margin

number | 'auto' | `${number}%`
Sets margin on all sides.
number | 'auto' | `${number}%`
Sets horizontal margin (left and right).
number | 'auto' | `${number}%`
Sets vertical margin (top and bottom).
number | 'auto' | `${number}%`
Sets top margin.
number | 'auto' | `${number}%`
Sets right margin.
number | 'auto' | `${number}%`
Sets bottom margin.
number | 'auto' | `${number}%`
Sets left margin.

Padding

number | `${number}%`
Sets padding on all sides.
number | `${number}%`
Sets horizontal padding (left and right).
number | `${number}%`
Sets vertical padding (top and bottom).
number | `${number}%`
Sets top padding.
number | `${number}%`
Sets right padding.
number | `${number}%`
Sets bottom padding.
number | `${number}%`
Sets left padding.

Overflow

OverflowString
default:"visible"
Controls how content that overflows the component’s box is handled.Values: "visible" | "hidden" | "scroll"

Other Properties

boolean
default:"true"
Controls whether layout calculations are enabled for this component.

Type Definitions

Usage Example