Skip to content

UI elements

Build a tree by calling ui constructors with a Luau table. ui.row{ ... } is shorthand for ui.row({ ... }); named entries are properties and numeric entries are ordered children. Return the tree from render(ctx), popout(ctx), or a component view. Constructors return Element values; do not manufacture kind yourself.

Start with your first widget or a menu. All constructors share layout, styling, and interaction properties. Components and shaders have their own pages.

Constructor Layout
ui.row Children from left to right; gap separates them.
ui.column Children from top to bottom. Use a fixed h and scroll = true for a scrollable list.
ui.stack Overlapping children; align positions each child. Useful for a material, shader, or path behind content.
ui.box A basic container for a background, hit target, or one child. An empty w = 0, h = 0 box draws nothing.
ui.row{ gap = 8, pad = 10, radius = 12, fill = "surface",
ui.symbol{ name = "clock", size = 16, color = "accent" },
ui.text{ text = ctx.data.clock, weight = "semibold" },
}

ui.row

row: (props: Props) -> Element,

ui.column

column: (props: Props) -> Element,

ui.stack

stack: (props: Props) -> Element,

ui.box

box: (props: Props) -> Element,

Element

export type Element = { kind: number, [any]: any }

Fields: kind

Constructor / property Behavior
ui.text.text Displayed string. style selects body, bold, mono, small, caption, or rounded presentation.
font system, or the family name of a font in the style’s fonts/ folder, for example "Space Grotesk"; unknown names use the system font and are logged once. filled = true sets the font’s FILL axis; with Material Symbols, text is an icon name.
size, weight, color Explicit font size in points, font weight, and color.
maxWidth, lines Bound text width and line count; without explicit limits text uses its measured size.
reserve Measure a stable placeholder string instead of the displayed text, for example reserve = "00:00:00" for a clock.
ui.symbol.name An SF Symbol name, with optional size, weight, and color.
ui.icon.app, window, pid An app bundle ID, opaque managed-window ID, or process ID. Use one identity source per icon; placeholder supplies a fallback symbol and color a tint.
ui.text{ font = "Material Symbols Rounded", text = "dashboard", filled = true, size = 22 }
ui.icon{ app = "com.apple.finder", placeholder = "app", w = 20, h = 20 }

A style ships its own fonts in fonts/ next to its shell.luau; fonts/ in the shell folder serves every profile. Each folder takes up to 16 .ttf or .otf files of at most 16 MiB. When two different files ship the same family, the first one loaded is used, and a changed font file takes effect after OmniWM restarts.

ui.text

text: (props: TextProps) -> Element,

TextProps

export type TextProps = Props & {
read text: string,
read style: TextStyle?,
read font: Font?,
read filled: boolean?,
read size: number?,
read weight: Weight?,
read lines: number?,
read color: Color?,
read reserve: string?,
}

Fields: text, style, font, filled, size, weight, lines, color, reserve

TextStyle

export type TextStyle = "body" | "bold" | "mono" | "small" | "caption" | "rounded"

Font

export type Font = "system" | string

Weight

export type Weight = "ultraLight" | "thin" | "light" | "regular" | "medium" | "semibold" | "bold" | "heavy" | "black"

ui.symbol

symbol: (props: SymbolProps) -> Element,

SymbolProps

export type SymbolProps = Props & {
read name: string,
read size: number?,
read weight: Weight?,
read color: Color?,
}

Fields: name, size, weight, color

ui.icon

icon: (props: IconProps) -> Element,

IconProps

export type IconProps = Props & {
read app: string?,
read window: string?,
read pid: number?,
read placeholder: string?,
read color: Color?,
}

Fields: app, window, pid, placeholder, color

ui.image.image accepts a contained image path, a qualified asset, or a host-issued Resource. A relative file such as assets/cat.gif resolves through the widget, shell, selected profile, and bundled default folders. Setting radius clips the image to rounded corners.

Animated GIF, PNG, WebP, and HEIC images play automatically. playing = false holds the current frame; speed scales playback speed. For Resource images, thumbnail requests 1–2048 pixels and defaults to 128. Preparation occurs off the UI thread; a pending or failed image leaves the rest of the widget usable.

ui.image{ image = "assets/cat.gif", w = 48, h = 48, radius = 8 }

ui.image

image: (props: ImageProps) -> Element,

ImageProps

export type ImageProps = Props & {
read image: string | Resource,
read thumbnail: number?,
read playing: boolean?,
read speed: number?,
}

Fields: image, thumbnail, playing, speed

ui.progress displays value as a fraction from 0 to 1. ui.slider uses the same normalized value; its onChange(ctx, event) receives event.value. Values are clamped to the displayed range. Convert percentages to fractions when rendering and back when sending a command.

ui.slider{ key = "volume", w = 180, h = 20,
value = (ctx.data.volume or 0) / 100, color = "accent",
onChange = function(ctx, event)
omniwm.run("volume set " .. tostring(math.floor((event.value or 0) * 100)))
end,
}

ui.progress

progress: (props: ProgressProps) -> Element,

ProgressProps

export type ProgressProps = Props & {
read value: number,
read color: Color?,
}

Fields: value, color

ui.slider

slider: (props: SliderProps) -> Element,

SliderProps

export type SliderProps = Props & {
read value: number,
read color: Color?,
read onChange: Click?,
}

Fields: value, color, onChange

Give ui.input a stable key and explicit width and height in a bar, island, popout or drawer:

ui.input{
key = "query", text = ctx.state.query or "", placeholder = "Search",
w = 240, h = 28, maxLength = 256,
onCommit = function(ctx, event) ctx.state.query = event.text end,
onCancel = function(ctx) ctx.state.editing = false end,
}

AppKit owns selection, composition, clipboard and undo. While focused, the native editor keeps its text across renders. Once unfocused, it adopts the next declared text. focus = true requests focus when it changes to true; it does not repeatedly steal focus. focus = false releases it. onFocus receives event.focused.

editable defaults to true. Set editable = false for selectable, copyable read-only content; it continues adopting declared text while focused and cannot be changed with typing, Cut, Paste or Undo. For a multiline input, wrap defaults to true. Set wrap = false to keep long lines unwrapped and allow horizontal as well as vertical scrolling.

onHover accepts a command string or a callback. A command string is delivered directly to the surface owner with the hover event, without a Luau callback. Entry has phase began, and exit has phase ended; hoverDelay and hoverGrace still apply, with zero giving immediate delivery.

Return commits a single-line field. With multiline = true, Return inserts a newline and Command + Return commits. Escape sends onCancel unless an IME is composing; it does not itself rewrite the value. Tab and Shift + Tab move among visible inputs. maxLength counts grapheme clusters, accepts 0–65,536 and defaults to 65,536. Composition can temporarily exceed the limit until committed.

onChange is optional. Pending changes for the same field are coalesced; commit, cancel and focus events keep their order. Omit onChange when only the final text matters, so typing needs no Luau callback. A shell focus session transfers between surfaces while retaining its previous-window return target.

Place editors in settled, untransformed regions. Their frames follow delivered layout and rectangular scroll clips. Arbitrary ancestor path masks, rotation, scale and animated layer geometry are not mirrored onto AppKit editors each frame. Surrounding shell content keeps its usual animations.

ui.input does not accept children or mask = true. Its onChange, onCommit, onCancel, and onFocus must be callbacks. Typography properties have the same meanings as on ui.text.

ui.input

input: (props: TextInputProps) -> Element,

TextInputProps

export type TextInputProps = Props & {
read key: string,
read text: string?,
read placeholder: string?,
read multiline: boolean?,
read editable: boolean?,
read wrap: boolean?,
read maxLength: number?,
read focus: boolean?,
read style: TextStyle?,
read font: Font?,
read size: number?,
read weight: Weight?,
read color: Color?,
read onChange: InputHandler?,
read onCommit: InputHandler?,
read onCancel: InputHandler?,
read onFocus: InputHandler?,
}

Fields: key, text, placeholder, multiline, editable, wrap, maxLength, focus, style, font, size, weight, color, onChange, onCommit, onCancel, onFocus

ui.path draws a vector shape from SVG path data, without writing a shader: d takes the commands M L H V C S Q T A Z (lowercase for relative), fill, border and borderWidth colour it, and evenOdd = true switches the fill rule. With viewBox = { x, y, width, height } the path is stretched to the element’s size, so viewBox = { 0, 0, 24, 24 } with w and h draws a 24-point icon at any size; without w and h it takes the viewBox size, or fills the ui.stack it is in. A path with mask = true shapes its stack like a mask shader.

When d changes with animate, two single open arcs (M followed by A) animate their ellipse and sweep, so a gauge’s stroke follows its ring as it grows or shrinks. A closed band made of an outer and an inner circular arc joined by two caps (M A A A A Z) follows its ring the same way. Other path morphs, including enter = { d = "..." } as a popout opens, require matching segment types and counts after parsing. An SVG arc can split into different numbers of cubic segments depending on its sweep. Incompatible paths display the destination outline immediately.

ui.stack{ material = "thin", w = 120, h = 120,
ui.path{ viewBox = { 0, 0, 24, 24 }, mask = true,
d = "M12 2 L15 9 L22 9 L16.5 13.5 L18.5 21 L12 16.5 L5.5 21 L7.5 13.5 L2 9 L9 9 Z",
enter = { d = "M12 12 L12 12 L12 12 L12 12 L12 12 L12 12 L12 12 L12 12 L12 12 L12 12 Z" } } }

OmniWM ships liquid.metal, which grows a drop from the bar item into the popout:

function popout(ctx)
return ui.stack{ material = "clear", bridge = true,
ui.shader{ source = "liquid.metal", fps = 60 },
ui.column{ pad = 16, gap = 4,
ui.text{ text = ctx.data.clock, style = "bold" },
ui.text{ text = ctx.data.date },
},
}
end

ui.path

path: (props: PathProps) -> Element,

PathProps

export type PathProps = Props & {
read d: string,
read viewBox: { number }?,
read evenOdd: boolean?,
}

Fields: d, viewBox, evenOdd

This block is copied verbatim from the shipped declarations. Use the symbol index to jump to individual constructors and all their types.

ui

declare ui: {
component: (props: ComponentProps) -> Element,
row: (props: Props) -> Element,
column: (props: Props) -> Element,
stack: (props: Props) -> Element,
box: (props: Props) -> Element,
text: (props: TextProps) -> Element,
input: (props: TextInputProps) -> Element,
symbol: (props: SymbolProps) -> Element,
icon: (props: IconProps) -> Element,
image: (props: ImageProps) -> Element,
progress: (props: ProgressProps) -> Element,
shader: (props: ShaderProps) -> Element,
glass: (props: GlassProps) -> Element,
shape: (props: ShapeProps) -> Element,
path: (props: PathProps) -> Element,
slider: (props: SliderProps) -> Element,
popout: InputHandler,
}