Skip to content

Layout and styling

Every UI element accepts Props; specialized constructors add their own fields. Dimensions, offsets, radii, gaps, and padding are in points. Properties are optional unless the constructor’s type requires them. Children are the numeric entries of the property table.

Property Meaning and default
key Stable identity under the same parent for retained handlers and motion. Use a distinct key for each logical item; native inputs require one.
w, h Explicit width/height; omitted dimensions use intrinsic layout. An unsized shader fills its stack without enlarging it.
grow Nonnegative weight dividing spare space along a row/column’s main axis; default 0.
gap Space between row/column children; default 0.
pad Equal inset on all sides; default 0.
center Center children across the row/column’s cross axis; default true. False starts them at the padding.
align Placement inside an overlapping stack; defaults to center. Supports leading/trailing, top/bottom, and the four corners.
scroll Enable native scrolling in an overflowing fixed-size row or column.
marquee On a scrolling row with one passive ui.text child, repeat overflowing text through its viewport. maxWidth caps the viewport’s preferred width; leave the child text uncapped. The copy is visual only, and the containing widget owns clicks.
ui.row{ w = 260, pad = 12, gap = 8,
ui.text{ text = "Status", grow = 1 },
ui.text{ text = "Ready", color = "accent" },
}

Align

export type Align =
"center"
| "leading"
| "trailing"
| "top"
| "bottom"
| "topLeading"
| "topTrailing"
| "bottomLeading"
| "bottomTrailing"

A Color is a palette role ("accent", "surface", "foreground"), a role with alpha ("surface/0.8"), a "#RRGGBB" or "#RRGGBBAA" string, or a packed 0xRRGGBBAA number. 0 is transparent. Role alpha must be 0–1; unknown roles fail validation. Profiles and palettes lists palette configuration.

Property Meaning and default
fill Background color or tint. Omitted fill is transparent.
border, borderWidth Edge color and stroke width in points.
radius Rounded corners; also clips images.
opacity Painted opacity; default 1.
material Native background material; omitted means none. glass on a popout root uses Liquid Glass; clear draws no panel behind it.
blurRadius, saturation Layer-material blur 0–64 points and saturation 0–3. Omitted blur uses the material; saturation defaults to 1.8. Does not alter root glass/popover system materials.
shadow, shadowRadius Shadow color and blur radius in points.
mask A shader/path shapes its parent stack; use one mask per stack. See shaders and effects.

Color

export type Color = string | number

Material

export type Material = "none" | "ultraThin" | "thin" | "regular" | "thick" | "ultraThick" | "bar" | "popover" | "glass" | "clear"

Palette roles include background, surface, elevatedSurface, highestSurface, foreground, secondaryForeground, mutedForeground, border, accent, accentForeground, success, warning, error, focus, shadow, scrim, and badge. Container roles are accentContainer, secondaryAccent, secondaryContainer, tertiaryAccent, and tertiaryContainer, each container with a …Foreground role. Named hue roles are red, orange, yellow, green, mint, teal, cyan, blue, indigo, purple, pink, brown, and gray.

Property Meaning
hover, hoverScale, hoverOpacity, hoverMaterial, hoverAnimate Hover color/material or paint feedback. Unspecified values retain the element’s ordinary appearance.
help Tooltip text.
pressScale, pressOpacity, pressFill, pressAnimate Native mouse-down feedback; a transparent pressFill = 0 explicitly replaces the base fill.
dx, dy, scale, rotate Paint offsets in points, scale (default 1), and rotation in degrees. A 90-degree text rotation also takes rotated layout space.
animate, appear, exit, enter, loop, trail Motion and identity transitions; see input and motion.
onClick, onRightClick, onScroll Command strings or callbacks; see actions.
onPress, onHover, hoverDelay, hoverGrace Boundary callbacks and dwell/grace in seconds; see native input.
gesture, onGesture, gestureEvents, scrollMomentum Captured pointer/scroll gestures and scroll delivery; see gestures.
focusable, focusRing, keys, onKey, onOutsidePress Declared keyboard input and island dismissal; see keyboard input.

Popouts, desktop resources, and workspace targets

Section titled “Popouts, desktop resources, and workspace targets”
Property Meaning
popout Shorthand for opening the widget’s popout(ctx) when no explicit click action is present. Equivalent to onClick = ui.popout.
bridge On a popout root, stretches its background toward the opening bar item. Clicks there still reach the bar. In a clear popout only drawn/actionable elements catch the pointer.
attach On a popout root, places the panel flush with its bar instead of leaving the usual gap.
open, close Explicit opening/closing seconds for shader progress; see shader timing.
accepts, onDrop, onDropHover, dragItems, onDragOut Resource drop/drag declarations; see resources and desktop services.
target, menu, preview, drag, drop Managed window/workspace interaction metadata for bar items. Targets use IDs from ctx.data.bar. menu enables the native target menu, preview enables window previews, drag starts managed-item dragging, and drop publishes a managed-window destination. Shift-click a bar target moves the focused window there. These are separate from Resource dragging.

Pointer hit testing follows drawn/actionable shapes: shader transparent pixels pass through, path outlines define their targets, and stack masks constrain hits. Transparent island windows still require a live click-through check on the target macOS system; cached island hit rectangles conservatively include rounded corners and path holes.

Props

export type Props = {
read cursor: ("grab" | "pointer")?,
read decorative: boolean?,
read manipulationCommit: string?,
read manipulationFollow: { response: number, bounce: number? }?,
read effect: { source: string, values: { number }?, fps: number?, bleed: number? }?,
read accepts: { ResourceKind }?,
read onDrop: ((ctx: Context, event: DropEvent) -> ())?,
read onDropHover: ((ctx: Context, event: DropHoverEvent) -> ())?,
read dragItems: { Resource }?,
read onDragOut: ((ctx: Context, event: DragOutEvent) -> ())?,
read appear: Presence?,
read exit: Presence?,
read reveal: Reveal?,
read morph: Morph?,
read key: string?,
read rotate: number?,
read loop: { dx: { number }?, dy: { number }?, rotate: { number }?, paused: boolean? }?,
read trail: boolean?,
read w: number?,
read h: number?,
read grow: number?,
read gap: number?,
read pad: number?,
read center: boolean?,
read fill: Color?,
read material: Material?,
read blurRadius: number?,
read saturation: number?,
read bridge: boolean?,
read attach: boolean?,
read open: number?,
read close: number?,
read enter: Enter?,
read mask: boolean?,
read border: Color?,
read borderWidth: number?,
read radius: number?,
read opacity: number?,
read hover: Color?,
read hoverScale: number?,
read hoverOpacity: number?,
read help: string?,
read animate: Animate?,
read hoverAnimate: (Motion | number)?,
read hoverMaterial: Material?,
read onClick: Click?,
read onRightClick: Click?,
read onScroll: Click?,
read onPress: InputHandler?,
read pressScale: number?,
read pressOpacity: number?,
read pressFill: Color?,
read pressAnimate: Animate?,
read onHover: (InputHandler | string)?,
read hoverDelay: number?,
read hoverGrace: number?,
read gesture: Gesture?,
read onGesture: InputHandler?,
read gestureEvents: ("boundary" | "all")?,
read scrollMomentum: ("consume" | "deliver")?,
read focusable: boolean?,
read focusRing: boolean?,
read keys: { string }?,
read onKey: InputHandler?,
read onOutsidePress: InputHandler?,
read popout: boolean?,
read align: Align?,
read dx: number?,
read dy: number?,
read scale: number?,
read shadow: Color?,
read shadowRadius: number?,
read shadowOffset: { x: number, y: number }?,
read pulse: Pulse?,
read target: string?,
read menu: boolean?,
read preview: boolean?,
read drag: boolean?,
read drop: boolean?,
read scroll: boolean?,
read marquee: boolean?,
read maxWidth: number?,
[number]: Element,
}

Fields: cursor, decorative, manipulationCommit, manipulationFollow, effect, accepts, onDrop, onDropHover, dragItems, onDragOut, appear, exit, reveal, morph, key, rotate, loop, trail, w, h, grow, gap, pad, center, fill, material, blurRadius, saturation, bridge, attach, open, close, enter, mask, border, borderWidth, radius, opacity, hover, hoverScale, hoverOpacity, help, animate, hoverAnimate, hoverMaterial, onClick, onRightClick, onScroll, onPress, pressScale, pressOpacity, pressFill, pressAnimate, onHover, hoverDelay, hoverGrace, gesture, onGesture, gestureEvents, scrollMomentum, focusable, focusRing, keys, onKey, onOutsidePress, popout, align, dx, dy, scale, shadow, shadowRadius, shadowOffset, pulse, target, menu, preview, drag, drop, scroll, marquee, maxWidth