Skip to content

UIButtonProps

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

Props for UIButton (used by reconciler and props-driven constructor).

optional alignItems?: AlignItems

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

Cross-axis alignment of the button’s children. Defaults to "center".


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

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

LayoutProps.alignSelf


optional background?: BackgroundOptions

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


optional bitmap?: boolean

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

Bitmap font for the auto-wrapped string label (forwarded to the inner UIText). No effect when children is a composed element — set bitmap on the UIText directly in that case.


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").

LayoutProps.bottom


optional children?: string

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


optional consumeInput?: boolean

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

ConsumeInputProps.consumeInput


optional direction?: FlexDirection

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

Direction of the button’s own children, for icon-plus-label content added with addElement. Defaults to "column", so set "row" for a row.


optional disabled?: boolean

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


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.

LayoutProps.flex


optional flexBasis?: LayoutValue

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

LayoutProps.flexBasis


optional flexGrow?: number

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

LayoutProps.flexGrow


optional flexShrink?: number

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

LayoutProps.flexShrink


optional focusable?: boolean

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

Take part in focus navigation. Defaults to true for UIButton, UICheckbox and the six interactive @pixi/ui wrappers, false for everything else. false leaves the element enabled for the pointer.

FocusProps.focusable


optional focusBackground?: BackgroundOptions

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

Background painted while the button holds focus and the pointer is not on it. Omitted, a focused button keeps its resting background. An override supplying only a colour keeps the resting corner radius.


optional focusId?: string

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

Name this element so a sibling’s FocusProps.focusNeighbors can point at it. Unique inside one scope: a duplicate id draws a development warning, and the first element in tree order answers to it.

FocusProps.focusId


optional focusNeighbors?: FocusNeighbors

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

Per-direction overrides of the position rule.

FocusProps.focusNeighbors


optional focusStyle?: UIFocusStyle | null

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

The focus outline for this element alone. Each field falls back to the plugin-level focusStyle, then to the built-in default. null draws no outline on this element.

FocusProps.focusStyle


optional gap?: number

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

Space between the button’s children.


optional height?: LayoutValue

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

LayoutProps.height


optional hoverBackground?: BackgroundOptions

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


optional justifyContent?: JustifyContent

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

Main-axis distribution of the button’s children. Defaults to "center".


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").

LayoutProps.left


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

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

LayoutProps.margin


optional maxHeight?: LayoutValue

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

LayoutProps.maxHeight


optional maxWidth?: LayoutValue

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

LayoutProps.maxWidth


optional minHeight?: LayoutValue

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

LayoutProps.minHeight


optional minWidth?: LayoutValue

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

LayoutProps.minWidth


optional onAdjust?: (direction) => void

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

Called with -1 for left and 1 for right while this element is focused, consuming that press. Up and down still move focus.

-1 | 1

void

FocusProps.onAdjust


optional onClick?: () => void

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

void


optional onFocusChange?: (focused) => void

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

Called with true when focus arrives and false when it leaves, including when the scope stops taking input. Use it to show focus without an outline: a marker beside the row, a swapped sprite, a sound.

boolean

void

FocusProps.onFocusChange


optional onHover?: (hovering) => void

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

boolean

void

PointerEventProps.onHover


optional onPointerOut?: () => void

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

void

PointerEventProps.onPointerOut


optional onPointerOver?: () => void

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

void

PointerEventProps.onPointerOver


optional padding?: Padding

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

Padding inside the button. Replaces the default 12 px horizontal and 6 px vertical padding; drop the prop to get that default back.


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.

LayoutProps.position


optional pressBackground?: BackgroundOptions

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


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").

LayoutProps.right


optional rotation?: number

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

Rotation in radians about LayoutProps.transformOrigin. Default 0.

LayoutProps.rotation


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.

LayoutProps.scale


optional textStyle?: Partial<TextStyleOptions>

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


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").

LayoutProps.top


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.

LayoutProps.transformOrigin


optional truncate?: "clip" | "ellipsis"

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

Overflow behavior for the auto-wrapped string label, forwarded to the internal UITextProps.truncate. Omitted, the label wraps to the button’s content width (and an auto-height button grows to fit). Set "clip" / "ellipsis" to keep the label on a single line so it can’t spill out of a fixed-size button — the safe choice for variable-length (i18n) labels.


optional truncateWith?: string

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

String the "ellipsis" truncate mode appends, forwarded to the internal label. Defaults to "…" (U+2026), which several pixel fonts lack — pass "..." for one of those.


optional visible?: boolean

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

LayoutProps.visible


optional width?: LayoutValue

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

LayoutProps.width


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.

LayoutProps.zIndex

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.