Log inGet started

Styling

Updated December 5, 2026
{ type = "vertical", style = {
    width = 320, padding = 16, gap = 12,
    background = "#16181d",
    borderRadius = 14,
    boxShadow = "0 10px 30px rgba(0,0,0,0.35)",
  }, children = { ... } }

The LSP checks a style table at the call site and flags a misspelled key against what the renderer accepts, so a wrong name is a diagnostic rather than a key that silently does nothing. This guide covers those keys and the CSS-parity ones the renderer consumes beyond the common set (animation, transition, opacity, backdropFilter, filter, outline, per-state variants). When you are unsure a key took, the gui toolbox's validate tool names anything the renderer rejected, and the screens of the public UI Style Gallery world (found by ZeroMind search) show every key in real use.

How a value is written

  • Colors — a CSS string ("#rrggbb", "#rrggbbaa", "rgb(r,g,b)", "rgba(r,g,b,a)", a named colour, "transparent") or a numeric array ({r,g,b} / {r,g,b,a}; components <= 1 read as 0..1, otherwise 0..255).
  • Lengths — a number of logical pixels, or a "N%" string (a fraction of the parent's content box). For size keys, a plain number strictly between 0 and 1 also reads as a fraction, so width = 0.5 is half the parent and width = 320 is 320 px; use the "50%" string when you want no ambiguity.
  • Box-sides (padding, margin, backgroundSlice) — one number for all sides, {x, y} for a horizontal/vertical pair, or {top, right, bottom, left}. Per-side keys (marginTop, borderLeftWidth, …) override the shorthand.
  • Angles / durations / functions inside a CSS string follow CSS: linear-gradient(135deg, …), 0.4s, ease-out, blur(8px), translateY(16px) scale(0.96).

Layout — the box model and flexbox

Layout is flexbox. The two container types set the main axis: horizontal is a row, vertical is a column. Children flow along the main axis; the keys control how.

  • Size — width, height, and the minWidth / maxWidth / minHeight / maxHeight constraints. Omit a size and the box hugs its content.
  • Box model — padding insets the content from the border; margin insets the box from its siblings; gap is the spacing between children (default 8). Per-side paddingTop / marginLeft / … refine the shorthand. borderWidth sits between padding and margin, exactly as in CSS.
  • Distribution — justifyContent (alias justify) positions children along the main axis: start, center, end, space-between, space-around, space-evenly. alignItems (alias align) positions them across it: start, center, end, stretch.
  • Growth — flex = 1 makes a child take a share of the free main-axis space (shorthand for grow 1 / shrink 1 / basis 0); flexGrow, flexShrink, flexBasis are the longhands. Two siblings both at flex = 1 split the row evenly; flex = 2 versus flex = 1 splits it two-to-one.
  • Out of flow — position = "absolute" takes a child out of the flex flow and pins it with left / top / right / bottom, measured from the nearest positioned ancestor (a container with position set). This is how you place a badge on a card, an overlay over a panel, or compose freely instead of by flow. position = "fixed" pins to the viewport. A screen's root vertical, horizontal or grid takes them too: with position = "absolute" or "fixed", the root is a box of its own inside the screen, placed by its insets. A side with no size and only one inset hugs the content, and left with right (or top with bottom) stretches the box between them. Its background, its ui.getLayoutInfo box and its hit area are that box, so a corner readout or a caption band covers only its own part of the screen. A root with no position fills the screen, and position = "relative" moves that box by its insets, the way a margin moves it.
  • Clipping — overflow = "hidden" (or "clip") crops children to the box, following its borderRadius; overflow = "scroll" scrolls them.

A grid lays its children out in columns, row by row. gridTemplateColumns lists the column tracks: a length (120px or a bare number), a percentage of the grid (25%), a share of the free width (1fr), auto, or repeat(n, <track>). Lengths and percentages are what they say; auto tracks take their content's width; fr tracks share what is left, in proportion. When no fr track claims the free width, the auto tracks share it. Each cell is its track's width, and a % width inside a cell is a fraction of that track. A % size gives its box no width of its own for a track to fit, so a cell whose only content is a %-sized box, in an auto track beside an fr track, is 0 wide: give that box a length, or its track a length or an fr share. edui.table is a grid.

A modal or a popup lays its content out in the room the safe area leaves it, 8 points in from each edge and less its own frame. Each child hugs its content up to that room's width, a % size or % limit on it is a fraction of the room, and content taller than the room scrolls inside it. A width the child declares stands, so a dialog that fits a desktop and a phone alike gives its card a width and maxWidth = "100%": width = 600, maxWidth = "100%" is 600 points on a desktop and the whole room on a 360 point phone. Add maxHeight = "100%" and give its list a height with flexShrink = 1 and a minHeight, and on a short screen the list gives up its height before the buttons below it leave the room.

A frame lays a changed screen out before it paints it, and a layout settles in one or two passes. A size that depends on the size it produces can keep a layout moving for longer than a frame has passes, and that frame paints the screen before it settles: a box can be missing or out of place. Such a screen is reported as a layout-unsettled warning through validate and ui.lastValidation(screen), naming a tree that was still moving; a definite width or height on the container it names is the usual fix.

Fill — background, gradients, image, frost

A box's fill layers in a fixed order — solid colour, then gradient, then image — so you can stack them. They paint behind a widget's own box as well: a button, label, richText, canvas or image takes them exactly as a vertical does. A slider, checkbox and input, and the frame of a window, modal, popup, area or docked panel, take background as a solid colour on their own chrome; a gradient stated on one of those is reported by gui validate / ui.lastValidation as background-gradient-not-painted.

  • background (alias backgroundColor) — a solid colour. A container with no background is transparent, and the scene or parent shows through; give a root an opaque background so it reads as a surface. A gradient string in background paints as the gradient key does.
  • gradient — a CSS gradient string painted over the solid fill. All three CSS kinds are supported: linear-gradient(<angle>deg, <color> <pos>%, …) (angle by CSS convention — 0deg up, 90deg right, 180deg down), radial-gradient(<color> <pos>%, …) (a soft vignette or glow from the centre), and conic-gradient(from <angle>deg, <color> <deg>, …) (colour swept by angle — the dial, pie, and ring form). A single stop is a flat fill.
  • repeatingGradient — a repeating-linear-gradient(…) for diagonal stripe bands. dotPattern — a radial-gradient(…) tiled on the dotTile grid as a halftone dot screen. Both paint over the fill and clip to the box.
  • backgroundImage — a texture (by asset ref, name, or guid). backgroundFit maps it into the box: stretch (default), cover, contain, tile, or 9slice (corners fixed, edges/centre stretched — a resizable bordered bitmap; the corner insets are backgroundSlice). It fills the box's own outline, so a borderRadius or clipPath cuts it the way it cuts the fill. "none" is a box with no picture. While a reference is still being fetched the box paints a [loading <ref>] plate; a reference whose load failed paints a [failed <ref>] plate and names the reference once in the log. They are the same plates an image widget shows for the same reference, so a dead reference reads differently from a slow one and from a live one. imagePlaceholder = "none" on the box (or on an image widget) paints nothing in the picture's place instead, so the box's own fill shows until the texture arrives: the form a player-facing screen takes, where a plate naming a reference is no part of the design. A failed load is still named in the log.
  • backdropFilter = "blur(<n>px)" — frosts whatever is behind a translucent box, the CSS backdrop-filter: the frosted-glass look. Pair a translucent background (e.g. rgba(20,20,30,0.6)) with the blur.
  • backgroundShader — a render-target/shader pipeline drawn as a live, procedural fill.

Border and corners

borderColor + borderWidth stroke the box. Per-side borderTopWidth / borderRightWidth / borderBottomWidth / borderLeftWidth set edges independently — two lit edges make an L-shaped corner bracket, a common HUD motif. borderRadius rounds the corners: a number of pixels, or "50%" for a full circle/pill. Rounding clips the fill, the gradient, and (with overflow:hidden) the children.

outline is a stroke drawn outside the border box that consumes no layout space — the CSS outline, with outlineColor and outlineOffset pushing it out. A focused widget draws a focus ring only when its style states one: set focusOutlineColor or a focusOutlineWidth above zero, and shape it with focusOutlineCornerRadius. A widget whose style states neither draws nothing for focus.

Depth — shadow

boxShadow is the CSS box-shadow: one or more comma-separated layers, each [inset] <dx> <dy> <blur> <spread>? <color>.

  • An outer shadow (no inset) lifts the box off what is behind it — "0 10px 30px rgba(0,0,0,0.4)".
  • An inset shadow recesses or glazes the surface — "inset 0 2px 6px rgba(0,0,0,0.5)" for a pressed well, "inset 0 1px 0 rgba(255,255,255,0.4)" for a top sheen.
  • Stack layers with commas: a drop shadow, a coloured glow, and an inset highlight in one string.

Shadows follow the element's transform, so a rotated or scaled box keeps a correct halo. elevation = "sm" | "md" | "lg" | "xl" is a preset shadow when you do not want to spell one out.

Depth on a dark UI reads from contrast, not from a black shadow. A dark drop-shadow over a near-black background is invisible — the shadow colour and the background are the same, so a panel with only boxShadow still looks flat and pasted-on. On a dark theme, separate a panel from its background with a step in lightness and a lit top edge, and keep the drop-shadow as a soft supporting cue:

  • Lift the fill. The panel's background must be a visible step lighter than what sits behind it — a #0e1116 page under #1a2029 panels, not #0a0d12 under #12161d (a step so small the eye cannot see it). A subtle top-to-bottom linear-gradient on the panel (lighter at the top) mimics a light from above and reads as a raised surface.
  • Light the top edge. A one-pixel inset highlight — "inset 0 1px 0 rgba(255,255,255,0.06)" — catches the imagined light on the panel's upper rim; a hairline borderColor a shade lighter than the fill defines the whole edge. These do more for perceived elevation on dark UIs than any drop-shadow.
  • Glow the accents. Depth cues on dark themes are colour, not just black: a coloured outer shadow on a selected or active element ("0 0 16px rgba(60,231,255,0.25)") makes it float above its neighbours.
  • Then add the black drop-shadow ("0 12px 30px rgba(0,0,0,0.35)") as the final, softest layer — stacked after the highlight and glow — for the last bit of separation. It supports the lightness step; it cannot replace it.

Effects — opacity, transform, filter, clip-path

  • opacity — 0..1, fades the box and its whole subtree (CSS opacity).
  • transform — the CSS transform, space-separated about the box centre and cascaded to the subtree: translate() / translateX() / translateY(), scale() / scaleX() / scaleY(), rotate(), skewX() / skewY(). It does not disturb layout, which is what makes it the right thing to animate. The box moves with the picture: a press lands on the widget where it is drawn, and ui.hitTest, ui.getLayoutInfo and gui.bounds state the box it is drawn in (for a rotate or a skew, the upright box the turned one covers).
  • filter — the CSS filter on the box and its subtree: blur(<n>px), drop-shadow(…), brightness(), contrast(), grayscale(), saturate(), and the rest, space-separated.
  • clipPath = "polygon(x y, …)" — the CSS clip-path: each coordinate a % of the border box or a px length. Clips fill, gradient, border, and subtree to an arbitrary polygon (a slanted card, a chevron), and the transform maps the result.

Text

On a label (and any text-bearing widget): color, fontSize, fontFamily ("monospace", "proportional", or a registered font family — ui.listFonts() and the gui toolbox's fonts tool name every one of them), fontWeight (CSS 100..900 or "bold"; ≥700 synthesises a heavy face), fontStyle ("italic" / "oblique"), letterSpacing (px or a CSS "0.06em"), lineHeight (a unitless multiplier or a CSS "150%" / "24px"), textAlign (left / center / right), textTransform (uppercase / lowercase / capitalize), textDecoration (underline / line-through), textShadow (CSS "<dx> <dy> <blur>? <color>", comma-separated layers), and textStroke (CSS -webkit-text-stroke, "<width>px <color>") for an inked glyph outline.

Which font families fontFamily can select

fontFamily takes a CSS family list, and each name in it is matched against the families the UI text renderer has registered. Every widget that draws text selects its face from it — label, button, checkbox, input, richText and a collapsible's header — and so does a canvas text paint command, through its own font field. ui.listFonts() is that list — one row per family carrying:

  • family — the name to write in fontFamily.
  • aliases — the other names that select the same family: web-font names ("arial", "verdana", "times new roman"), CSS generic families ("serif", "monospace", "cursive", "fantasy"), and the face names registered under it. Matching is case-insensitive.
  • faces — the concrete face in each of the regular / bold / italic / boldItalic slots. fontWeight and fontStyle pick among these, so a family with a real bold face renders one, and a family with only regular gets a synthesised heavy.
  • system — true when the family came from the host OS rather than a bundled font asset. A host-OS family renders on the machine whose OS has it, and the web build reads no OS fonts at all, so a UI that must look the same everywhere picks a family whose system is false.

fonts is the same list from the tool surface — bundled families on its own, and the host-OS ones as well when asked for them.

for _, f in ui.listFonts() do
    print(f.family, table.concat(f.aliases, ", "))
end
-- arimo    arial, helvetica, helvetica neue, liberation sans, sans-serif, ...
-- cousine  courier, courier new, liberation mono, monospace, ...

The built-in library holds the faces the engine's own screens draw in: Arimo (sans-serif, Arial, Helvetica) and Cousine (monospace, Courier New), each in its regular, bold, italic and bold italic faces, the editor's JetBrains Mono and Bricolage Grotesque, and the per-glyph fallback faces. Other typefaces are .font assets from ZeroMind: the public Optional Fonts world holds Tinos (serif, Times New Roman), Comic Neue (cursive), Archivo Black (fantasy, Arial Black), Anton (Impact), EB Garamond (Garamond), Gelasio (Georgia), PT Serif (Palatino, Book Antiqua) and the bold and oblique DejaVu Sans faces. Name one and the engine brings it: the first time a text names a family no face answers to, the engine looks the family up among those fonts by its name and the names each face's face.json gives it, declares every face of the family for the session, and draws the text in it once the face arrives, read from ZeroMind (the text draws in its fallback face for the frames in between). The world is left as it was, in an editing session and a player's alike, so a family a text names never appears among the world's changes. To keep a family's faces in the world, install them like any asset: font.missingFamilies() names the call for each family it brought. When ZeroMind cannot be read (a server error, a network failure), the families wait in the fetching state and the fonts are read again, sooner at first and then every few minutes, until a read answers. In a CSS list such as "Anton, Impact, sans-serif" the names before the first one that draws are the ones brought, the first ZeroMind holds winning. font.missingFamilies() lists every family a text named that no face answered to, with what came of it and the texts that asked.

A fontFamily naming a family nothing has registered and ZeroMind does not hold paints in the default proportional face, and the screen reports it: validate and ui.lastValidation(screen) both carry an unknown-font-family warning once that screen has painted, naming the family you asked for, why ZeroMind brought no face of it and the families that are registered. It is one warning per family per screen, and the text keeps being drawn — a missing font leaves the words on screen in the fallback face.

One registration makes a face answer to every name it was registered under — the name its .font asset carries, the family group it stands in, the web-font and generic names its descriptor declares, and the family the font file itself declares — and each of those names selects it on every text surface, the UI widgets and text.* 2D and 3D alike. So font.list() and font.reconcile(), which read the same faces from the shaper's side, name faces a fontFamily reaches; font.reconcile()'s shapedWith is the family a name selects, spelled the way the font file spells it. ui.listFonts() remains the list the UI resolves against, and the one that also carries the host-OS families a text.* layout has of its own; validate / ui.lastValidation is the verdict on a family that took nothing, and topics/text covers the shaping side.

Text in any script: per-glyph fallback and on-demand faces

Every family falls back glyph by glyph to every other face the UI holds, so a character the selected family lacks is drawn from a face that has it, whatever fontFamily names. Japanese, Korean and Chinese (simplified and traditional) need no setup: the built-in library declares a CJK face (Noto Sans CJK SC, in chunks by script and by how common a character is) whose files are read only when a label first shows a character one of them covers. The first frame draws that character as a box; the face is read and installed within a few frames, and from then on every label draws it. A session that shows no CJK text never reads those files.

  • ui.missingGlyphs(): the characters the UI is showing without a glyph (as the box), across every surface it paints. Empty is the answer you want; a character that stays in it is one no face the UI holds, or can load, covers.
  • font.onDemand(): every declared on-demand face and where it stands: declared, requested (with requestedBy, the character that asked), installed (with the bytes it loaded) or failed (with error).
  • font.prefetch(text): start reading the faces text needs before the screen showing it paints.
  • font.ready(text): true once every on-demand face text needs is installed, so a screen opened then draws every glyph on its first frame.

A font of your own joins the same fallback: register it as a .font asset (asset.create("font", name, { bytes = ... })) and every label draws the characters it covers that the selected family lacks. A large face can be declared on demand instead of read at boot; types/font shows the layout.

local text = "日本語のメニュー"
font.prefetch(text)                    -- read the faces before the screen opens
task.spawn(function()
    while not font.ready(text) do task.wait() end
    ui.showScreen("menu")              -- its first frame draws every glyph
end)
for _, f in ipairs(font.onDemand()) do print(f.name, f.state, f.requestedBy) end
print(#ui.missingGlyphs())             -- 0 once every character has a glyph

A session starts with every on-demand face unread, and a face stays installed for the rest of the session, so a screen's first open in a fresh session is the one a player sees. Within one session, text whose faces another screen (or the agent terminal) already drew is ready at once: font.ready and font.onDemand() say which case a check is in.

A label lays out on one line by default. For paragraph text that wraps, set props = { wrap = true }. The lines are laid out against the width the label's box resolves to — its own width when it has one, otherwise the width its container gives it, whatever that container's own alignItems. textAlign places each of those lines inside the box, exactly as it places the single line of an unwrapped label. A wrapping label whose box comes out narrower than its own longest word — the width below which the wrap has nothing to break on but the glyphs — is reported as a wrap-label-no-width warning through validate and ui.lastValidation(screen), naming both widths.

Interaction states

A widget can restyle itself when the pointer is over it, while it holds focus, or while it is pressed. The quick keys cover the common case: backgroundHover / colorHover (fill and text while hovered) and backgroundActive (fill while pressed).

For a full alternate look per state, give the style a state block: a style table whose properties replace the base's while that state is on. Three states restyle: hover, focus and active (pressed). They compose in that order, so a held press wins over a hover. A block is written either as a key of the style itself or as an entry of a states map, with or without the CSS pseudo-class colon; these four spell the same hover block:

style = { background = "#333344", hover = { background = "#0055ff" } }
style = { background = "#333344", [":hover"] = { background = "#0055ff" } }
style = { background = "#333344", states = { hover = { background = "#0055ff" } } }
style = { background = "#333344", states = { [":hover"] = { background = "#0055ff" } } }

A block for any other state, a disabled key or another pseudo-class such as [":pressed"] (as a key of the style or in states), restyles nothing, and ui.lastValidation(screen) names it with a style-state-not-overlaid warning.

transition smooths a state change instead of snapping it — the CSS transition, e.g. "0.18s ease" or a per-property form, so a hover fill fades in over its duration rather than switching instantly. Transitions animate the response to input; animation (below) animates on its own timeline.

Motion — animation

Any node animates through an animation table on its style, modelled on CSS @keyframes:

animation = {
  keyframes = {
    ["0%"]   = { opacity = 0, transform = "translateY(16px)" },
    ["100%"] = { opacity = 1, transform = "translateY(0px)" },
  },
  duration = 0.55,        -- seconds
  delay = 0.1,            -- seconds before it starts
  easing = "ease-out",    -- linear | ease | ease-in | ease-out | ease-in-out
  fill = "both",          -- hold the first frame before the delay, the last after
  iterations = 1,         -- a number, or "infinite"
}

Each keyframe is a percentage key ("0%", "50%", "100%") mapping to a style fragment; the renderer interpolates the animatable properties between them every frame. Animate opacity and transform for entrances and idle motion — they move without touching layout. boxShadow and colours also tween, which is how a breathing glow or a pulsing accent is done.

Two shapes earn their keep:

  • Entrance — iterations = 1 with fill = "both". Because fill holds the first keyframe until delay elapses, staggering the delay across sibling panels makes them cascade in one after another instead of all at once.
  • Idle — iterations = "infinite" for a slow bob, a breathing glow, a pulsing live-dot. Keep the amplitude small.

Animations advance in play, not edit. Edit mode pauses gameplay, and time along with it, so a still captured in edit shows a frozen frame — flip to play (wld play) to see motion run, and capture a time-sampled collage to confirm an entrance cascades and settles or an idle loop keeps moving.

An entrance or an idle loop gives way to a reduced-motion @media block (below) for the person who asked their device for less motion.

Motion the engine steps: springs, flings, placements

A transition or an animation is stated in the style and plays on its own timeline. Motion that answers what happens (a menu that springs open, a card that pops when it is picked, a bubble that is dragged and thrown) moves the widget by its id, with a call, and the engine steps it each frame: no Luau runs per frame and the screen tree is not sent again.

-- A menu that springs down into place with a little overshoot.
ui.spring("menu", { y = 0, opacity = 1 }, { stiffness = 400, damping = 0.6 })

-- A card that pops when picked: a kick to its scale, which springs back to 1.
ui.spring("card_3", { scale = 1 }, { velocity = { scale = 4 }, stiffness = 600, damping = 0.5 })

-- Drag a card with the finger (the card carries onDrag = "drag_card"),
-- then throw it with the release velocity.
local held = { x = 0, y = 0 }
function onCallback(id, data)
  if id == "drag_card" then
    local d = data.value
    if d.dragStarted then
      local m = ui.motion("card") -- where a fling left it; 0, 0 at its layout place
      held = { x = m.x, y = m.y }
    end
    held.x += d.dx
    held.y += d.dy
    if d.dragStopped then
      ui.fling("card", { x = d.vx, y = d.vy }, { bounds = { minX = -240, maxX = 240 }, onSettle = "card_rest" })
    else
      ui.setMotion("card", held)
    end
  elseif id == "card_rest" then
    print("the card came to rest at", data.value.x)
  end
end
  • Channels: x, y (an offset in points from where layout puts the widget), scale (about its centre, 1 unscaled) and opacity (multiplying its own, 1 unchanged). The widget is drawn moved, with its subtree, outside its own transform; its layout box and its neighbours stay where they are, and a press lands on it where it is drawn.
  • ui.spring(id, target, options?) springs each channel target names. stiffness (default 170) is how hard it pulls, damping the damping ratio (default 0.8: below 1 overshoots and settles, 1 arrives without overshooting, above 1 creeps in), mass defaults to 1. velocity starts it with a speed per channel (a channel with a velocity and no target springs back to where it rests). Calling it again mid-motion starts from where the widget is with the speed it has, so a retarget never jumps.
  • ui.fling(id, velocity, options?) throws x and y with a velocity in points per second and lets them slow to a stop: decay (default 0.35 s) is how fast, and it travels about velocity * decay. bounds ({ minX, maxX, minY, maxY }) keeps the offset inside: reaching a bound, or starting beyond one, it springs onto it. An onDrag handler receives the pointer's speed as vx, vy; on the frame dragStopped is true that is the release velocity.
  • ui.setMotion(id, values) and ui.setMotions({ [id] = values }) place widgets at once, at rest. A script that runs its own simulation (bubbles that drift and push each other apart) states each frame's positions in one ui.setMotions call: no tree is built or sent, and nothing is measured anew. A placement that leaves no channel of a spring or fling moving runs its onSettle, as ui.stopMotion does.
  • ui.stopMotion(id) holds the widget where it is (a finger landing on a moving one); ui.clearMotion(id) draws it where layout puts it again, and unregistering a screen does the same for every widget drawn on it, so a screen registered again under its name starts at its layout.
  • ui.motion(id) reads { x, y, scale, opacity, velocity, target, moving } as the last frame left it (target is where each channel comes to rest). A widget with no motion (never moved, or back at rest where layout puts it) reads at its layout place: 0, 0, scale 1, opacity 1, not moving.
  • onSettle, a callback id in the options of ui.spring or ui.fling, reaches the screen's onCallback once every channel rests, with data.value = { id, x, y, scale, opacity }.
  • At rest it costs nothing: a screen whose widgets all rest asks the engine for no frame.
  • Reduced motion is honoured on its own: while the person asks for less motion, a spring moves the widget to its target at once, an opacity change is a 0.15 s cross-fade, and a fling moves at once to where the throw would have brought it to rest. A widget fading out (a spring to a lower opacity) moves once its fade has ended, so the fade is seen where it was: a closing sheet sprung off-screen and to opacity = 0 fades in place, then goes. A script's own simulation (ui.setMotions) reads ui.reducedMotion() and drops its drift itself.

Reduced motion: @media blocks

A person can ask their device for less motion: Android's Remove animations, a browser's prefers-reduced-motion, the animation settings of Windows, macOS and the Linux desktop. A style follows that wish with a media block, the CSS @media rule: a style table that applies over the widget's whole cascade while its query matches, and stops applying the moment it no longer does, with no Luau running.

style = {
  transition = "opacity 0.3s ease, transform 0.3s ease",
  animation = { keyframes = { ... }, duration = 0.55, fill = "both" },
  ["@media (prefers-reduced-motion: reduce)"] = {
    transition = "none",   -- every change shows at once
    animation = "none",    -- no entrance, no idle loop
  },
}

The same block can be written in a media map, keyed by the query with or without @media:

style = { media = { ["(prefers-reduced-motion: reduce)"] = { transition = "opacity 0.15s linear" } } }
  • Queries: (prefers-reduced-motion: reduce), (prefers-reduced-motion: no-preference) and the bare (prefers-reduced-motion), joined by and, negated by a leading not, listed as alternatives with ,, with an optional media type (all and screen match, print does not). A query the engine cannot evaluate never applies, and ui.lastValidation(screen) names it with a media-query-unparsed warning.
  • What a block holds: anything a style holds: flat properties, state blocks, transition, animation, and further @media blocks, which apply over it while their own query matches too. A block inside a state block (hover = { ["@media (prefers-reduced-motion: reduce)"] = { ... } }) applies to that state. transition = "none" and animation = "none" state that the widget has none, which replaces one the base, a class or a theme states.
  • Order: blocks apply after the cascade (theme, class, inline), in that order, so an inline block wins over a class block and any block wins over the plain properties. A block inside a state block takes its layer's place in that order: a class's ["@media ..."] = { hover = { ... } } wins over a theme's hover = { ["@media ..."] = { ... } }, and the other way round.

Under reduced motion, keep every function and change what moves: drop drift, overshoot and travel; show a change at once or as a short cross-fade (transition = "opacity 0.15s linear").

From Luau, ui.reducedMotion() reports the preference with where it came from (platform is "unknown" on a platform that states no such setting, which is not the same as off), ui.onReducedMotionChange calls back when it changes, ui.matchMedia(query) tests a query, and ui.setReducedMotion(true | false | nil) states an in-app preference (an app's own "Reduce motion" switch) that wins over the OS setting while it stands; a world's preference ends when the world's scripts end. Use them for motion a script drives itself.

Themes and tokens

Inline style always wins, but a shared look belongs in a theme, which reaches further than per-widget style:

  • A theme's styles maps a widget class to a style table, applied to every node carrying that class — the same UiStyle vocabulary, with $token indirection.
  • A theme's tokens is the global layer: a fixed set of named tokens the engine applies to the chrome every box, window, and widget gets by default — the outline on every box (border + border-width), the surface fills (card, popover, surface), the roundings (radius-widget, radius-lg), the focus ring (ring), the window shadow. The full set is the UiThemeTokens type. Zeroing border / border-width flattens the whole UI's default outline in one move.

The built-in dark and light themes state the same colour contract, the tokens the editor draws every panel with, so a screen that reads them looks like the editor and follows a theme switch:

RoleTokens
Surfaces, deepest to highestsurface-inset (a field), surface-ground (the window), surface-panel, surface-raised (a card on a panel), surface-overlay (a menu, a popover), surface-hover
Linesborder, border-subtle
Textforeground, text-strong, text-secondary, text-tertiary, and text-faint for decoration alone (a separator, a disabled control)
Accentaccent (the fill), accent-hover, accent-active, accent-foreground (the text on the fill), accent-text (the accent as text, a link or a line), accent-subtle (its soft fill)
Selectionselection, selection-foreground, and ring for focus

Every text token reads at WCAG AA's 4.5:1 or more on every surface, on selection and on accent-subtle, and accent-foreground does on accent. The accent is origozero.ai's ember, the one the world loading screen draws. The older names (background, card, popover, surface, primary, muted-foreground, editor-*) are stated as references to these.

So the cascade is, outermost to innermost: theme tokens (global chrome) → theme styles (per class) → inline style (per node). The gui toolbox's setTheme tool switches the active theme; themes lists them. ui.loadTheme(name, theme?) registers a theme under name, resolving its $token references first: a built-in theme by name (ui.loadTheme("dark")) or a { tokens, styles } table of your own; ui.setTheme(name) then activates it.

Where to look

The gui toolbox answers for what the renderer did with a style:

  • validate / ui.lastValidation — the verdict on a style a screen registered: a key the renderer does not take, and a fontFamily that selected no face, each named against the widget that carried it. It also reports what the renderer rejected on the last render.
  • ui.getTheme / themes — the active theme and what is installed.
  • widgetProps — a widget's props (its data + callback ids), distinct from its style.
  • fonts / ui.listFonts() — the font families fontFamily can select, with the aliases and weight/style faces of each.
  • The public UI Style Gallery world — every key above, in ten complete working screens in ten styles; find it with ZeroMind search and read a screen's source in the shell with zm show @<guid> (the guid of the screen's module, from the search hit).