Openui lang

OpenUI Lang Syntax

Expression grammar and common component signatures.

OpenUI Lang is line-oriented:

identifier = Expression

Example:

root = Stack([title, form])
title = TextContent("Sign up", "large-heavy")
form = Form("signup", [nameField, emailField], actions)
nameField = FormControl("Name", Input("name", "Your name", "text", ["required"]))
emailField = FormControl("Email", Input("email", "you@example.com", "email", ["required", "email"]))
actions = Buttons([submitBtn, cancelBtn], "row")
submitBtn = Button("Submit", "submit:signup", "primary")
cancelBtn = Button("Cancel", "action:cancel", "secondary")

Supported expression types

TypeSyntaxExample
Component callTypeName(arg1, arg2)CardHeader("Title", "Subtitle")
String"text""hello"
Number42, 3.14, -13.14
Booleantrue / falsetrue
Nullnullnull
Array[a, b, c][col1, col2]
Object{key: value}{variant: "info"}
ReferenceidentifiernameField

Rules

  • First statement is the entry point.
  • For OpenUI library prompts, start with root = Stack(...).
  • Arguments are positional, based on Zod key order.
  • Optional args can be omitted from the end.
  • Forward references are allowed.

Common default-library signatures

ComponentSignature
StackStack(children, direction?, gap?, align?, justify?, wrap?)
CardCard(children, variant?, direction?, gap?, align?, justify?, wrap?)
TextContentTextContent(text, size?)
FormForm(name, fields, buttons)
FormControlFormControl(label, input, hint?)
InputInput(name, placeholder?, type?, rules?)
SelectSelect(name, items, placeholder?, rules?)
ButtonButton(label, action, variant?, type?, size?)
ButtonsButtons(buttons, direction?)
TabsTabs(items)
TabItemTabItem(value, trigger, content)
TableTable(columns, rows)
BarChartBarChart(labels, series, variant?, xLabel?, yLabel?)

For full generated signatures, inspect:

openuiLibrary.prompt(openuiPromptOptions);

On this page