Skip to content

LayoutProps

Defined in: ui/src/types.ts:133

Common layout props every element can accept (applied to its Yoga node).

optional alignSelf?: "auto" | "center" | "flex-start" | "flex-end" | "stretch" | "baseline"

Defined in: ui/src/types.ts:157


optional bottom?: PositionValue

Defined in: ui/src/types.ts:183

Offset from the containing block’s bottom edge — px or "<n>%" (only applies to position: "absolute").


optional flex?: number

Defined in: ui/src/types.ts:156

Shorthand for the common CSS flex: <number> case — expands to flexGrow: <number>, flexShrink: 1, flexBasis: 0. Use it for a child that should fill the remaining main-axis space (e.g. the text column between a fixed icon and a fixed button): sizing from a 0 basis means it won’t claim its content width and push its siblings, and its text wraps cleanly. Prefer this over flexGrow: 1 alone, which keeps flexBasis: auto (content width) and overflows. Explicit flexGrow/flexShrink/flexBasis override the parts this expands to.


optional flexBasis?: LayoutValue

Defined in: ui/src/types.ts:145


optional flexGrow?: number

Defined in: ui/src/types.ts:143


optional flexShrink?: number

Defined in: ui/src/types.ts:144


optional height?: LayoutValue

Defined in: ui/src/types.ts:135


optional left?: PositionValue

Defined in: ui/src/types.ts:177

Offset from the containing block’s left edge — px or "<n>%" (only applies to position: "absolute").


optional margin?: number | { bottom?: number; left?: number; right?: number; top?: number; }

Defined in: ui/src/types.ts:140


optional maxHeight?: LayoutValue

Defined in: ui/src/types.ts:139


optional maxWidth?: LayoutValue

Defined in: ui/src/types.ts:137


optional minHeight?: LayoutValue

Defined in: ui/src/types.ts:138


optional minWidth?: LayoutValue

Defined in: ui/src/types.ts:136


optional position?: "relative" | "absolute"

Defined in: ui/src/types.ts:175

Positioning mode for this element relative to its parent. Defaults to "relative" — the element flows in the parent’s flex layout. Set to "absolute" to lift the element out of the flow and pin it via left / top / right / bottom against the parent’s content box.

A position: "relative" ancestor acts as the containing block for any absolute-positioned descendants — useful for HUD overlays, modal backdrops, and badge markers. See <ZStack> in @yagejs/ui-react for an opinionated overlay primitive.


optional right?: PositionValue

Defined in: ui/src/types.ts:181

Offset from the containing block’s right edge — px or "<n>%" (only applies to position: "absolute").


optional rotation?: number

Defined in: ui/src/types.ts:199

Rotation in radians about LayoutProps.transformOrigin. Default 0.


optional scale?: number | { x: number; y: number; }

Defined in: ui/src/types.ts:197

Scale about LayoutProps.transformOrigin, one number for both axes or one per axis. Default 1. 0 and negative values are allowed.


optional top?: PositionValue

Defined in: ui/src/types.ts:179

Offset from the containing block’s top edge — px or "<n>%" (only applies to position: "absolute").


optional transformOrigin?: number | { x: number; y: number; }

Defined in: ui/src/types.ts:192

The point scale and rotation turn about, as fractions of the element’s computed size: 0 is the top-left corner, 0.5 the centre, { x: 0.5, y: 1 } the middle of the bottom edge. Default 0. This prop, scale, rotation and zIndex change how the element is drawn, never its Yoga box.


optional visible?: boolean

Defined in: ui/src/types.ts:184


optional width?: LayoutValue

Defined in: ui/src/types.ts:134


optional zIndex?: number

Defined in: ui/src/types.ts:206

Draw and pointer order among the siblings in the same container: a higher value draws on top and takes the pointer first. Default 0; siblings with equal values keep the order they were added in. To rise above an element in a neighbouring container, raise that container.

Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/ui.md.