Built-in component property table
Updated: 2026-11-20. This table is exported from the current public definitions in bern-ir::spec and covers 89 built-in components. Bold properties are required, the rest are optional; these are declaration rules. For what each target implements see the platform capability table, and for concrete usage see component usage.
Property types
| Type | Declaration meaning |
|---|---|
Id |
Stable identifier or string |
DisplayText |
tr! text or a displayable state expression |
LocalizedText |
tr! static localized text |
Icon |
Icon name string (SF Symbols naming). Apple targets can use any SF Symbol; other targets map the name to the platform's own icon, and all of them draw at least the names in the Bern icon set (bern_target_api::icon_set::NAMES); using a name the target does not have is reported as an error by the check |
ImageResource |
Image resource; Image also supports engine image state |
SvgResource |
Declared bundled SVG resource |
Number |
Build-time number |
Length |
Logical length number or constrained numeric expression |
NumberValue |
Read-only numeric expression |
TextValue |
Read-only text expression |
Bool |
Boolean expression |
Flag |
Build-time true / false |
Shortcut |
Keyboard shortcut string literal, or a text binding that the shortcut follows |
FileKinds |
File kind string |
FileField |
Writable MediaSource, Option<MediaSource>, or Vec<MediaSource> (multi-file pick) session field |
SaveFileField |
Writable MediaSource, Option<MediaSource>, or String session field filled by a save-file dialog |
DateField |
Writable CalendarDate session field |
DateValue |
Read-only CalendarDate expression |
PositionField |
Writable scroll position session field |
TextField |
Writable text session field |
KeysField |
Writable Vec<String> or Vec<i64> session field that stores row keys |
BoolField |
Writable boolean session field |
IntField |
Writable integer (i64) session field |
NumberField |
Writable floating-point session field |
OptionalNumberField |
Writable Option<f64> session field the element writes, cleared to None when what it reports ends |
PickerField |
Writable enum session field whose variants carry labels |
SelectionField |
Writable navigation selection enum field |
SelectionValue |
Enum value matching the navigation selection field |
Items |
Record list binding |
KeyField |
Name of the stable key field of list records |
PathField |
Writable route list session field |
Route |
Typed route value |
WindowId |
Window kind identifier |
TypeName |
Generated window handle type name |
SlotName |
Module slot name |
StyleVariant |
style! style variant name |
Transition |
Transition declaration or name |
MotionToken |
Motion token name |
HeroName |
Static name of a shared element |
KeyValue |
Read-only text, numeric or enum identity value |
Watched |
Read-only boolean, number, text or enum, or optional values and lists of them: the value that Watch follows |
ColorRole |
Semantic color role |
NumberList |
Read-only number list |
PatternName |
style! pattern name |
MediaSource |
Media source binding, optional or non-optional |
Player |
A player in the app's player catalog |
Query |
Typed query call |
Feature |
An entry point in the owning feature contract |
NativeFile |
Relative path literal to a co-located native UI implementation file next to the declaring .rs file |
NativeName |
Lowercase snake_case identifier naming a prop or draft slot exposed to a NativeView |
NativeScalar |
Read-only expression passed into a NativeView (bool, i64, f64, String, optional i64/f64/String, or, on targets with native_lists, a Vec of bool/i64/f64/String) |
NativeDraftField |
Writable session draft field exposed to a NativeView (bool, i64, f64, String, or Option<f64>) |
Fixed enums list the allowed keywords directly. The table does not repeat every cross-property constraint: Switch / Picker / Slider / ColorPicker must specify either a draft source or a controlled source, and a controlled source must also provide an action; overlay on Window requires role: utility (and the primary window cannot have role: utility); appear_delay must be used together with appear; the specific errors are checked by the compiler. Resources, semantic colors, localization, feature coverage and types are validated further as well.
Components
| Component | Properties (bold = required) | Children, action and placement |
|---|---|---|
WindowSet |
handle: TypeNameprimary: WindowIdaccent: KeyValuepalette: KeyValueappearance: KeyValueicon: KeyValue |
Contains only ["Window", "MenuBar", "StatusItem"]; no action; root node only |
MenuBar |
None | Contains only ["CommandMenu"]; no action; directly inside ["WindowSet"], at most one; shown natively on macOS, iPadOS, Windows (WinUI 3 / XAML Islands MenuBar), and Linux (GTK 4 PopoverMenuBar) |
StatusItem |
label: LocalizedTexticon: Iconimage: SvgResourcelogin_item: Flagshown: Bool |
Contains only ["CommandItem", "CommandMenu", "Divider"], which can be inside if, match, ForEach; no action; directly inside ["WindowSet"], at most one; the menu does not read or write drafts or window fields, and menu items do not take pick or shortcut; either icon or image: icon is shown only on macOS, while Windows and Linux show the app icon; image is a monochrome SVG that all three desktop platforms show in white or black according to the appearance of the bar it sits in; not shown on iOS, tvOS, Android or the Web |
CommandMenu |
label: LocalizedTextrole: app / file / edit / view / window / help |
Contains only ["CommandItem", "CommandMenu", "Divider"], which can be inside if, match, ForEach; no action; directly inside ["MenuBar", "CommandMenu", "StatusItem"]; either label or role, and role is used only for menus on the menu bar |
CommandItem |
id: Idlabel: DisplayTextshortcut: Shortcutenabled: Boolchecked: Boolpick: FileFieldsave: SaveFileFieldsuggested_name: DisplayTextfiles: FileKindspaste: TextField |
No children; must bind an action; directly inside ["CommandMenu", "StatusItem"]; the drafts of menu bar items belong to the primary window; at most one of pick, save or paste |
Window |
id: WindowIdtitle: LocalizedTextinitial: open / closedpresentation: auto / virtual / floating / native_requiredrole: standard / settings / dialog / utilityoverlay: Idwidth: Numberheight: Numbermin_width: Numbermin_height: Numberconfirm_close: Boolclose_message: LocalizedTextchrome: standard / unifiedimmersive: Boollandscape: Boolidle_after: Numberidle_enabled: Bool |
Exactly one child; action optional; directly inside ["WindowSet"]; role: utility declares a compact floating tool window, and overlay places it beside a bern::overlay of the same id when opened, keeping its position afterward (auto-closing when that overlay hides, locks, or moves to the taskbar) |
Column |
variant: StyleVariantgap: Lengthpadding: Lengthpadding_x: Lengthpadding_y: Lengthwidth: Lengthheight: Lengthalign: leading / center / trailing |
May contain children; no action |
FocusRegion |
None | One content view; during text editing, the first pointer action outside the region only removes focus and consumes the whole click, keeping the draft; controls inside the region and the next click work normally |
Row |
variant: StyleVariantgap: Lengthpadding: Lengthpadding_x: Lengthpadding_y: Lengthwidth: Lengthheight: Lengthalign: top / center / bottom / baseline |
May contain children; no action |
Accordion |
count: NumberValueselected: NumberValuecollapsed_width: Lengthheight: Lengthgap: Lengthcorner: Length |
May contain children; no action; when height is omitted, it uses the remaining available height |
Grid |
min_width: Lengthgap: Lengthrow_gap: Lengthpadding: Lengthpadding_x: Lengthpadding_y: Lengthcell_ratio: Numbercell_extra: Lengthmasonry: Flag |
May contain children; no action |
Stack |
variant: StyleVariantenabled: Boolalign: top_leading / top / top_trailing / leading / center / trailing / bottom_leading / bottom / bottom_trailingwidth: Lengthheight: Lengthunder_bars: Flag |
May contain children; no action |
Marquee |
duration: Lengthphase: Numberpaused: Boolopacity: NumberValue |
May contain children; no action |
ScaleBox |
width: Lengthheight: Length |
May contain children; no action |
Positioned |
x: Lengthy: Lengthwidth: Lengthheight: Lengthbleed: Bool |
May contain children; no action; bleed lets a layer in a ScaleBox scene extend to the edge of the box on the canvas edges it reaches |
Modal |
width: Lengthheight: Lengthcover: compact |
May contain children; optional action (runs when clicking outside or pressing Escape); without height it is as tall as its content (a ScrollView inside it is as tall as the content it scrolls), and it stops at the window edge when the window cannot fit it |
Flow |
gap: Length |
May contain children; no action; the children in each line are vertically centered, and Spacer takes the rest of the width of its line |
Timer |
interval: Numberenabled: Bool |
No children; must bind an action |
Watch |
value: Watched |
No children; must bind an action; runs on mount and when the value changes |
Shortcut |
key: Shortcutenabled: Boolquiet: Flaghold: BoolFieldhold_after: Number |
No children; must bind an action |
PickerOption |
value: KeyValuelabel: DisplayText |
No children; no action; directly inside ["Picker"] |
Rail |
axis: horizontal / verticalanchor: start / center / endoverhang: Length |
May contain children; no action |
Spacer |
No own properties | No children; no action |
WindowButtons |
edge: leading / trailing |
No children; no action; reserves the traffic lights at leading on macOS and the caption buttons at trailing on Windows, and takes no space elsewhere |
Divider |
No own properties | No children; no action |
ScrollView |
axis: vertical / horizontalsnap: start / centerposition: PositionFieldarrival: nudgeindicators: automatic / hidden / mouseopen_at: Numberopen_center: NumberValueanchor: Numberbrowsing: BoolField |
May contain children; no action |
SplitView |
No own properties | Contains only ["Sidebar", "Detail"]; no action |
Sidebar |
selection: SelectionFieldcollapsed: BoolFieldwidth: Lengthid: Idfallback: SelectionValue |
Contains only ["Search", "Section", "SidebarItem", "Pages", "SidebarHeader", "SidebarFooter"]; no action; directly inside ["SplitView"]; collapsed (false = expanded) syncs bidirectionally in wide windows and ignores automatic narrow-window folding |
SidebarHeader |
role: content / title |
May contain children; no action; directly inside ["Sidebar"] |
SidebarFooter |
No own properties | May contain children; no action; directly inside ["Sidebar"] |
Detail |
titled: Bool |
May contain children; no action; directly inside ["SplitView"] |
DetailFooter |
No own properties | May contain children; no action; directly inside ["Detail"], at most one, and not placed in if, match or ForEach. Content pinned to the bottom of the detail column, staying visible across navigation pushes within it |
SidebarItem |
value: SelectionValuelabel: DisplayTexticon: Iconbadge: NumberValuevariant: StyleVariant |
No children; no action; directly inside ["Sidebar", "Section"] |
Section |
title: DisplayTextfooter: DisplayTextstyle: grouped / plainpadding_x: Lengthpadding_y: Length |
May contain children; no action |
Slot |
id: SlotName |
No children; no action |
Pages |
slot: SlotNameall: Flag |
No children; no action; directly inside ["Sidebar", "Section", "Tabs"]. Inside Tabs, each page expands into a Tab whose content is that page's component; all: true includes every contributed page |
PageContent |
slot: SlotNameselected: SelectionField |
No children; no action |
Form |
title: DisplayTextvariant: StyleVariantgap: Lengthrow_height: Lengthpadding_x: Lengthpadding_y: Length |
May contain children; no action |
Navigation |
path: PathFieldid: Idreset: KeyValue |
May contain children; no action; when reset changes, returns to the root |
Destination |
No own properties | May contain children; no action; directly inside ["Navigation"] |
NavLink |
id: Idroute: Route |
May contain children; no action |
ControlGroup |
label: DisplayTextheight: Length |
May contain children; no action |
Tabs |
selection: SelectionFieldid: Idfallback: SelectionValuebar: standard / floating |
Contains only ["Tab", "Pages", "TabAccessory"]; no action. The selected tab takes the app's accent color; bar: floating makes the tab bar on phones a capsule clear of the screen edges: iOS 26 and later already do this, Compose draws a floating capsule (with a capsule of its own behind the selected item), and TabAccessory is a capsule too; GTK, WinUI 3 and the Web keep their own tab bars On Android, a window shorter than the compact breakpoint (window.short, a phone in landscape) shows floating tabs as a rail of icons beside the pages, the accessory a capsule over their foot. |
TabAccessory |
shown: Bool |
May contain children; no action; directly inside ["Tabs"], at most one, and not placed in if or ForEach. A persistent strip above all the pages, for example a mini player for what is playing; it collapses when shown is false |
Tab |
value: SelectionValuelabel: DisplayTexticon: Icondisplay: title_and_icon / icon |
May contain children; no action; directly inside ["Tabs"]. display: icon shows only the icon (icon must be written), and label is still the accessible name |
SplitButton |
id: Idlabel: DisplayTextvalue: BoolFieldchecked: Boolicon: Iconshape: capsuleheight: Lengthmore_label: DisplayTextshortcut: Shortcut |
May contain children; either value or checked; checked requires an action, which runs on toggle |
PopoverButton |
panel_appearance: inherit / window / surfaceid: Idlabel: DisplayTexticon: Iconfont_size: Numbershape: capsuleheight: Lengthprominence: standard / plainpresented: BoolFieldopen: Boolshortcut: Shortcutplacement: above / below |
May contain children; open must bind an action and is mutually exclusive with presented; no action when open is not used |
Inspector |
presented: BoolFieldwidth: Number |
May contain children; no action |
Toast |
content: DisplayTexticon: Iconkey: KeyValueduration: Number |
No children; no action |
Pinch |
id: Idlabel: DisplayTextvalue: NumberFieldmin: Numbermax: Numberfeature: Feature |
Exactly one child; action optional |
Swipe |
id: Idlabel: DisplayTextvalue: NumberFieldmin: Numbermax: Numberaxis: vertical / horizontaldistance: Numbercontinuous: Flagactive: BoolFieldfeature: Feature |
Exactly one visual child plus an optional OnCommit; action optional |
OnCommit |
None | No children; must bind an action; directly inside ["Swipe"], at most one; runs once after its Swipe finishes, never on cancel |
ScreenBrightness |
value: NumberFieldavailable: BoolField |
No children; no action; scoped host brightness override while mounted (0..1); available reports whether the host supports it |
Drop |
id: Idlabel: DisplayTextvalue: FileFieldfiles: FileKindsover: BoolFieldopens: Flagfeature: Feature |
Exactly one child; must bind an action |
Toolbar |
No own properties | Contains only ["Button", "IconButton", "Picker", "Menu", "Search", "Switch", "SplitButton", "PopoverButton", "Divider", "Spacer", "Text"]; no action |
Adaptive |
id: Id |
Contains only ["Layout"]; no action |
Layout |
size: compact / medium / expanded / large / tv |
May contain children; no action; directly inside ["Adaptive"] |
Menu |
id: Idlabel: DisplayTexthide_disabled: Flagicon: Iconstyle: button / iconbold: Flagshape: capsuleheight: Lengthplacement: above / below |
Contains only ["MenuItem", "Divider"]; no action; style: icon without icon renders a plain text trigger without a dropdown arrow |
MenuItem |
id: Idlabel: DisplayTexticon: Iconrole: normal / destructivechecked: Boolenabled: Boolfeature: Featureshortcut: Shortcutpick: FileFieldsave: SaveFileFieldsuggested_name: DisplayTextfiles: FileKindspaste: TextField |
No children; must bind an action; directly inside ["Menu", "TableMenu", "ContextMenu"]; at most one of pick, save or paste; checked shows the platform's checkmark state |
LanguagePicker |
id: Idlabel: DisplayTextlabel_hidden: Flag |
No children; no action; leads with a "Follow System" option ("system") followed by the app's supported languages |
List |
items: Itemskey: KeyField |
May contain children; no action |
ForEach |
items: Itemskey: KeyField |
May contain children; no action |
Table |
id: Idlabel: DisplayTextitems: Itemskey: KeyFieldselection: KeysField |
Contains only ["TableColumn", "TableMenu"], at least one TableColumn and at most one TableMenu; action optional, it is the primary action on the selected rows (double-click or Enter, or tapping a row on a touch screen); selection is a Vec<String> or Vec<i64> draft that stores the keys of the selected rows in row order. Uses the |item| row template |
TableColumn |
title: DisplayTextwidth: Numbersorted: Booldescending: Bool |
Exactly one child, which is the content of this column's cell in each row; action optional, runs when the header is clicked; directly inside ["Table"]; sorted and descending only show the sort indicator, and the order of the rows is decided by the engine |
TableMenu |
None | Contains only ["MenuItem", "Divider"]; no action; directly inside ["Table"]; opens on right-click or long press on a row, and if that row is not among the selected rows, it first selects only that row |
ContextMenu |
None | Contains only ["MenuItem", "Divider"]; no action; directly inside a pointer event owner (see below), at most one per element; not part of what the element shows; opens on right-click or long press on the element |
DoubleTap |
None | No children; must bind an action; directly inside a pointer event owner, at most one per element; runs on a double click or double tap; on a Button it is exclusive with the button's own action, elsewhere single clicks still reach the content |
WheelUp |
None | No children; must bind an action; directly inside a pointer event owner, at most one per element; runs once per notch the wheel or trackpad scrolls up over the element (the way that moves a scroll view toward its top), and the element takes that scrolling |
WheelDown |
None | No children; must bind an action; directly inside a pointer event owner, at most one per element; runs once per notch the wheel or trackpad scrolls down over the element, and the element takes that scrolling |
Hover |
delay: Number |
No children; must bind an action; directly inside a pointer event owner, at most one per element; runs when the pointer rests over the element, immediately or after delay seconds (>= 0) |
PreviewList |
items: Itemskey: KeyFielditem_height: Numbergap: Numbermore_height: Number |
Creates the first few items that fit completely in the available height; when items remain, leaves room for +N, with a default height of 22; does not scroll and does not create hidden items. Uses the |item| row template |
Text |
content: DisplayTextstyle: large_title / title / title2 / title3 / headline / subheadline / body / callout / footnote / caption / caption2 / control / codeemphasis: primary / secondary / tertiarycolor: accent / status.success / status.warning / status.errormark: ColorRolelines: Numberfont_size: Lengthline_height: Lengthruby: TextValuemarkdown: Flagselectable: Flagbold: Boollit: Lengthlit_path: TextValuelit_clock: NumberValuelit_since: NumberValue |
No children; no action; either color or emphasis; selectable: true enables native text selection and copying |
Canvas |
width: Lengthheight: Lengthlabel: DisplayTextbleed: Flag |
Contains only ["Shape", "Series", "Pattern"]; no action |
Shape |
kind: rect / rounded / capsule / ellipsex: Numbery: Numberwidth: Numberheight: Numbercorner: Numberfill: ColorRolefill_from: ImageResourcefade: up / down / left / rightstroke: ColorRolestroke_width: Numberdash: Numberdash_gap: Numberopacity: Number |
No children; no action; directly inside ["Canvas"] |
Series |
values: NumberListkind: area / linemax: NumberValuefill: ColorRolestroke: ColorRolestroke_width: Numberopacity: Number |
No children; no action; directly inside ["Canvas"] |
Pattern |
name: PatternNameopacity: Number |
No children; no action; directly inside ["Canvas"] |
Label |
title: DisplayTexticon: Iconstyle: large_title / title / title2 / title3 / headline / subheadline / body / callout / footnote / caption / caption2 / control / codecolor: ColorRolefont_size: Numberdisplay: title_and_icon / icon |
No children; no action |
Svg |
source: SvgResourcestatic_source: SvgResourcewidth: Lengthheight: Lengthlabel: DisplayTextfit: contain / cover / fillplaying: Boolspeed: NumberValuerestart: NumberValueinteractive: Flagdata: DisplayTextexternal_links: Flag |
No children; no action |
WebPage |
url: DisplayTextcookies_file: DisplayTextcookie_domain: DisplayTextuser_agent: DisplayTextcontent_mode: auto / mobile / desktopclose_on: DisplayTextlabel: DisplayText |
No children; action optional (runs when an element matching CSS selector close_on is pressed); unavailable on tvOS, watchOS and Wear OS |
Image |
source: ImageResourcelabel: DisplayTextwidth: Lengthheight: Lengthfit: contain / cover / fillcorner: Lengthrendering: original / templatesaturation: NumberValueaspect: Number |
Optional single placeholder child (wrap several views in Stack, Column or Row); no action; saturation is from 0 (grayscale) to 1 (full color), can follow state, and animates with animate |
Progress |
value: NumberValuetotal: Numberlabel: DisplayTextstyle: bar / ringwidth: Lengthstroke_width: Number |
No children; no action; style: ring needs value; width and stroke_width only with style: ring |
Button |
id: Idlabel: DisplayTexticon: Iconshape: capsule / chipheight: Lengthwidth: fillrole: normal / destructive / cancelprominence: standard / prominent / plainenabled: Boolcursor: default / pointervariant: StyleVariantfeature: Featureshortcut: Shortcutpick: FileFieldsave: SaveFileFieldsuggested_name: DisplayTextfiles: FileKindsdefault_focus: Flagclears: TextFieldpaste: TextField |
May contain children; must bind an action; pick opens a single or multi-file (Vec<MediaSource>) picker, save opens a save-file dialog (optionally prefilled with suggested_name), and paste puts clipboard text into that draft before running the action; at most one of pick, save or paste |
IconButton |
id: Idicon: Iconfont_size: Numberheight: Lengthlabel: DisplayTextprominence: standard / prominent / plaincolor: ColorRoleenabled: Boolvariant: StyleVariantfeature: Featureshortcut: Shortcutpick: FileFieldsave: SaveFileFieldsuggested_name: DisplayTextfiles: FileKindspaste: TextFielddefault_focus: Flagicon_progress: NumberValuebadge_icon: Iconbadge_visible: Bool |
No children; must bind an action; at most one of pick, save or paste |
TextInput |
id: Idlabel: DisplayTextlabel_hidden: Flagvalue: TextFieldcurrent: TextValueprompt: DisplayTextkind: plain / secure / multilinesubmit: clearclear_key: NumberValuefeature: Feature |
No children; action optional; either value or current; with value the action runs on submit, and submit: clear clears the draft and gives up focus after the action; with current the action runs on every edit, the same expression in the action's arguments is the text typed, and while editing the engine's text does not overwrite the user's input; SwiftUI's clear_key clears when the number changes, for use with asynchronous success acknowledgements |
Search |
id: Idvalue: TextFieldprompt: DisplayTextfeature: Featureshortcut: Shortcutstyle: automatic / palettedisplay: automatic / iconpanel_prompt: DisplayTextwidth: Numberheight: Numberfont_size: Numbersuggest: Flag |
May contain children; action optional; display: icon only with style: palette |
SearchItem |
id: Idlabel: DisplayTexticon: Icondetail: DisplayTexthint: DisplayTextnavigation: Boolpick: FileFieldfiles: FileKindsfeature: Feature |
May contain children; must bind an action |
Switch |
id: Idlabel: DisplayTextvalue: BoolFieldchecked: Boollabel_hidden: Flagshape: capsule / chipheight: Lengthstyle: switch / checkbox / buttonvariant: StyleVarianticon: Iconshortcut: Shortcutlogin_item: Flag |
No children; action optional; login_item: true shows and changes the system login item, and is written without value, checked or an action |
ShortcutInput |
id: Idlabel: DisplayTextlabel_hidden: Flagcurrent: Shortcut (state, cannot be a literal)prompt: DisplayTextempty: DisplayTextenabled: Boolfeature: Feature |
No children; must bind an action, and in the action the expression identical to current is replaced with the chosen shortcut |
Slider |
id: Idlabel: DisplayTextlabel_hidden: Flagvalue: NumberFieldcurrent: NumberValuecontinuous: Flag (only with current)hover: OptionalNumberFieldmin: Numbermax: Numberstep: Numbermin_icon: Iconmax_icon: Iconfeature: Featureaxis: horizontal / vertical |
No children besides pointer events; action optional; hover holds where the pointer is along the track while it is over the slider, from 0 at min to 1 at max, and None otherwise; it does not change the value |
ColorPicker |
id: Idlabel: DisplayTextlabel_hidden: Flagvalue: NumberFieldcurrent: NumberValuefeature: Feature |
No children; action optional with value and required with current; stores a 24-bit sRGB color (0xRRGGBB); not available on tvOS, watchOS or Wear OS |
Video |
id: Idsource: MediaSourceplayer: Playerlabel: DisplayTextcontrols: standard / nonefit: contain / cover / fillsizing: standard / fillcorner: Length |
No children; no action. A video with controls: none shows only the picture and can be the content of a Button. sizing: fill makes the playback surface fill a parent container that has a definite size, and fit only controls how the video content is placed in the surface; danmaku drawn by the media core can use the letterbox bars. The default standard keeps the original layout. When the app registers a media core, the core draws into the surface the view gives it; see Windows, resources, and files |
Query |
id: Idquery: Querypresented: Boolloading: DisplayTextloading_style: automatic / skeleton / spinnerempty: DisplayTextfailed: DisplayTexticon: Icon |
Result template with an optional leading QueryStatusHeader; no action; automatic projects a compile-time skeleton when loading is omitted, or shows the native spinner when loading is explicit |
QueryStatusHeader |
— | Exactly one child; first direct child of Query, at most once; no action |
Picker |
id: Idlabel: DisplayTextvalue: PickerFieldselected: KeyValueitems: Itemskey: KeyFielditem_label: KeyFieldprompt: DisplayTextlabel_hidden: Flagshape: capsuleheight: Lengthstyle: automatic / menu / segmented / radio / inline / chips / combobox |
Contains only ["PickerOption"] (forbidden when items is given); action optional; items requires both key and item_label, and value / selected matches the key field type; style: combobox provides a filterable dropdown; chips accepts shape: capsule and does not accept height |
Tooltip |
content: DisplayTextkeys: Shortcutplacement: above / below |
Exactly one child; no action; shows contextual hover / focus help across all backends |
Banner |
id: Idseverity: info / success / warning / errortitle: DisplayTextcontent: DisplayTexticon: Icondismiss_label: DisplayText |
May contain trailing action children (such as Button); optional dismiss action (shows a close button when bound) |
Disclosure |
id: Idlabel: DisplayTexticon: Iconexpanded: BoolFieldopen: Bool |
May contain children; action optional (open requires an action and is mutually exclusive with expanded; omitting both uses local toggle state) |
NumberInput |
id: Idlabel: DisplayTextlabel_hidden: Flagvalue: NumberFieldcurrent: NumberValuemin: Numbermax: Numberstep: Numberprecision: Numberenabled: Bool |
No children; action optional with value and required with current; numeric text entry with native increment/decrement steppers and range clamping |
Alert |
title: DisplayTextmessage: DisplayText |
Contains only ["AlertAction"]; optional dismiss action; mounts a native modal confirmation dialog (typically guarded by if) |
AlertAction |
id: Idlabel: DisplayTextrole: default / cancel / destructiveenabled: Bool |
No children; must bind an action; directly inside ["Alert"] |
DatePicker |
id: Idlabel: DisplayTextlabel_hidden: Flagvalue: DateFieldcurrent: DateValuemin: DateValuemax: DateValueenabled: Bool |
No children; action optional with value and required with current; native calendar date picker backed by CalendarDate |
TimePicker |
id: Idlabel: DisplayTextlabel_hidden: Flagvalue: NumberFieldcurrent: NumberValuemin: Numbermax: Numberstep: Numberenabled: Bool |
No children; action optional with value and required with current; native time-of-day picker storing minutes since midnight (0..=1439) |
EmptyState |
title: DisplayTextmessage: DisplayTexticon: Icon |
May contain action children (such as Button); no action; centered placeholder for empty views and search results |
Badge |
content: DisplayTexttone: neutral / accent / success / warning / erroricon: Icon |
No children; no action; compact inline semantic status capsule |
Avatar |
source: ImageResourcelabel: DisplayTextsize: Lengthshape: circle / rounded |
No children; no action; circular or rounded avatar displaying an image with automatic initials fallback |
TreeView |
id: Idlabel: DisplayTextitems: Itemskey: KeyFieldparent: KeyFieldselection: PositionFieldexpanded: KeysFieldfeature: Feature |
Uses the |item| row template; action optional (runs on double-click / Enter); parent names an Option<Key> field referencing the parent row's key; selection stores the selected key and expanded stores the expanded node keys |
SplitPane |
id: Idaxis: horizontal / verticalratio: NumberFieldmin_first: Lengthmin_second: Length |
Exactly two children; no action; resizable split container with a draggable divider storing the leading pane's ratio (0..1) |
Reorderable |
id: Idlabel: DisplayTextitems: Itemskey: KeyFieldmove_from: IntFieldmove_to: IntFieldfeature: Feature |
Uses the |item| row template; must bind an action; writes the source and destination zero-based indices into move_from and move_to before running the action |
BottomSheet |
detents: medium / large / bothdrag_indicator: Flag |
May contain children; action optional (runs on dismiss); mounts a native bottom-anchored modal sheet (typically guarded by if) |
Refreshable |
id: Idrefreshing: Boolfeature: Feature |
Exactly one child; must bind an action; triggers pull-to-refresh (and CLI activate) and displays a native refresh indicator while refreshing is true |
NativeView |
id: Idlabel: DisplayTextswiftui: NativeFilewinui3: NativeFilecompose: NativeFilegtk: NativeFilegpui: NativeFileweb: NativeFile |
Contains only ["NativeValue", "NativeText", "NativeDraft", "NativeAction", "NativeNumber", "NativeBool", "NativeInput", "Fallback", "DoubleTap", "ContextMenu", "WheelUp", "WheelDown", "Hover"]; must specify at least one backend file and at least one CLI control entry (NativeAction / NativeNumber / NativeBool / NativeInput), at most one Fallback; targets without a matching backend file render Fallback (or fail the build if absent) |
NativeValue |
name: NativeNamevalue: NativeScalar |
No children; no action; directly inside ["NativeView"]; generates a typed read-only field in Props |
NativeText |
name: NativeNamecontent: DisplayText |
No children; no action; directly inside ["NativeView"]; passes localized tr! text into Props |
NativeDraft |
name: NativeNamevalue: NativeDraftField |
No children; no action; directly inside ["NativeView"]; exposes the current draft value in Props and a set_<name> callback in Actions |
NativeAction |
id: Idlabel: DisplayTextenabled: Boolfeature: Feature |
No children; must bind an action; directly inside ["NativeView"]; registered for CLI ui activate under <component>.<view>.<id> |
NativeNumber |
id: Idlabel: DisplayTextcurrent: NumberValuemin: Numbermax: Numberstep: Numberenabled: Boolfeature: Feature |
No children; must bind an action; directly inside ["NativeView"]; registered for CLI ui set-number under <component>.<view>.<id> |
NativeBool |
id: Idlabel: DisplayTextchecked: Boolenabled: Boolfeature: Feature |
No children; must bind an action; directly inside ["NativeView"]; registered for CLI ui set-bool under <component>.<view>.<id> |
NativeInput |
id: Idlabel: DisplayTextcurrent: TextValueenabled: Boolfeature: Feature |
No children; must bind an action; directly inside ["NativeView"]; registered for CLI ui edit / ui submit under <component>.<view>.<id> |
Fallback |
None | May contain children; no action; directly inside ["NativeView"], at most one; rendered on targets without a native file |
Skeleton |
width: Lengthheight: Lengthfraction: Numbermax_width: Lengthaspect: Numbercorner: Lengthshape: rect / capsule / circletone: primary / secondary / mediaopacity: Numberpulse: Flag |
No children; no action; non-interactive placeholder shape in text.primary at low opacity (primary 0.09, media 0.07, secondary 0.06, or explicit opacity) with a gentle pulse frozen under reduced motion; fraction cannot be combined with width and sizes width as min(available, max_width) * fraction |
When Grid is given cell_ratio, every row has the same height: column width ÷ cell_ratio + cell_extra (for example a 2 : 3 poster plus the height of two lines of text: cell_ratio: 0.6667, cell_extra: 54); items are laid out from the top of their cell, and taller content extends into the row gap below, unlike the default, which sets the row height from the tallest item.
With masonry, Grid becomes a masonry layout: items are laid out at their own heights, and each item goes into the column that is currently shortest (the leftmost one when columns are equally short), which suits cards of varying heights. SwiftUI and Compose use a custom layout, and the Web uses one-pixel-high grid rows so that each item spans its own height; GTK and Windows for now lay it out row by row as an ordinary grid.
Text(style: code) uses the platform's own monospaced font, slightly smaller than body text, for code, commands and file contents: the .monospaced design in SwiftUI, FontFamily.Monospace in Compose, the ui-monospace family on the Web, the monospace style class in GTK, and Cascadia Mono on Windows (Consolas when it is not available). The text block of style! can set its font size and weight like any other style.
Pointer events. DoubleTap, ContextMenu, WheelUp, WheelDown and Hover are written as direct children of the element they act on, which owns them: Button, NavLink, Video, NativeView, Slider, Image, Svg, Text, Label, Progress, Column, Row, Grid, Stack, Flow, ScaleBox or Positioned. They are not views and are not part of what the element shows, so a leaf such as Text or Slider can take them in braces, and they cannot be placed in if or ForEach. An element takes at most one of each. They are shortcuts: what they do must also be reachable through a button, a menu or a shortcut, since keyboards, remotes and assistive technologies do not double-click, right-click, hover or scroll a wheel.
Svg compiles animated and interactive .svg resources at build time into compact BSVG scenes played natively in pure Rust across all targets without a WebView; pointer interactions are declared on <svg> with data-bern-click / data-bern-dblclick and optional data-bern-ready, while static_source, data, and external_links remain accepted for source compatibility. Static SVGs without animations or interactions lower automatically to Image. See Animated SVG.
With lit, Text keeps that much of itself in its color and fades the rest, for words sung one by one: 2.5 is two characters and the left half of the third, on the targets that draw inside a character; below zero, all of it shows as usual. The count is in Unicode scalars. SwiftUI, Compose, WinUI and GTK draw it; the other targets show the text whole.
With lit_path the front end moves that place by itself, every frame, while lit is not below zero: lit_path lists seconds and characters in order, apart by spaces ("10 0 11 2 12 2"), and the place moves evenly from each to the next. lit_clock is the second it showed at lit_since, in seconds since the Unix epoch; a lit_since of zero stands still. State changes only when the route or the clock does, so nothing has to send each step. Windows moves it on the compositor.
Text(ruby:) places readings above ranges of the unchanged content. Its dynamic string is a JSON array such as [[0,2,"とうきょう"]]: start and end are half-open Unicode scalar indices in the original text, never UTF-8 bytes or UTF-16 units. Empty or [] keeps normal text layout. Readings reserve space above the corresponding wrapped lines and do not add characters to lit or lit_path. Floating text uses the same format in overlay::Line::ruby. Malformed, overlapping and out-of-bounds ranges are ignored. The annotation string is metadata, not localized display text; literals and conditional string expressions are accepted.
With markdown, the content of Text is inline Markdown: **bold**, *italic* or _italic_, `code`, ~~strikethrough~~ and [link](url), and a backslash makes the next marker display literally. SwiftUI hands it to the system's AttributedString(markdown:), Compose writes it as an AnnotatedString with styles and LinkAnnotation, the Web generates elements (not treated as HTML; links accept only web and email addresses), and GTK converts it to Pango markup; Windows for now strips the markup and shows only the text. A whole document (headings, lists, tables and so on) is split into blocks by the app itself, and each block is shown as such text.
Search placed in a Toolbar or a Sidebar is taken over by them; placed in a page, it is the platform's own search field (UISearchTextField on iOS, NSSearchField on macOS, input[type=search] on the Web), its children are the results listed below the field when the field has focus or contains text, and width / height / font_size are the size and font size of the field itself (for the search panel in a toolbar, they are the panel's size).
Rail(overhang:) makes the ticks extend this many points past each end of the track: a child at ratio f stands at f × (length + 2 × overhang) − overhang, like a timeline built with negative margins in CSS. ScrollView(open_at:) is the position on opening: the point at ratio f of the content is aligned to the same ratio of the view (0 the start, 0.5 center to center, 1 the end). ScrollView(open_center:) is also the position on opening: the point at ratio f of the content stops at the center of the view; near either end, where it cannot reach the center, the view scrolls as far as it can, and the point is still in view. It can bind an expression, which is read only once on opening, and the view does not scroll along when the value changes later; for example, it centers "now" as far as possible when a timeline opens.
The gap of Form is the distance between groups, row_height is the minimum row height, and padding_x / padding_y are the inner padding of the rows of all groups (a Section's own properties of the same name take precedence); when a form begins with Section(style: plain), it starts at the top of the page, and the rows of that group have no background, margins or separators, serving as a heading that scrolls with the form. The row padding the form gives groups does not apply to plain groups, which use only their own padding_x / padding_y. The leading plain group can also come from a slot, a component or a condition: during layout the form checks whether the first item is a plain group, and follows when the condition changes, so if window.compact { Section(style: plain) { … } } makes the form start at the top only in narrow windows. In style!, Form { background: role } is the background of the rows, and the form itself lets the page background show through.
Items in a Row take their own widths when they fit, and the remaining space is shared equally by Spacers and filling items; when they do not fit, the other items shrink in proportion to their own widths, but not below their own minimum widths. Spacer has no minimum length and is the first to shrink to zero when things do not fit, the same on every target. When leading text in a Row is immediately followed by a Spacer (a Text without a width, or a Column without align or with align: leading), the text takes the Spacer's place: the controls after it keep their own widths, and the text wraps within the remaining width, like the label of a system list row; SwiftUI and Compose lay it out this way, and other targets follow the general rule above. When width / height is given and the content is smaller, Column starts from the top and is placed horizontally by align, and Row starts from the leading edge and is placed vertically by align. A Column without align is the same as leading: buttons and other controls, as well as inner Column and Stack, keep their own widths, while horizontally filling content such as input fields, dividers, Grid and List spans the whole column; to make a button span the whole column, write Button(width: fill). A Column written directly in a window without a width is as wide as the window content area, starts from the top and is placed horizontally by align; a Stack without a size fills the content area; other body content smaller than the content area is laid out from the top-left corner.
Keep a page's query while showing another tab
Declare Query inside the page but outside the branch that switches tabs. Use presented to choose when to show its result and status controls. If the tab selector stays fixed, make it a sibling of the query so it works even before the first answer.
Column {
Switch(id: show_results, label: tr! { "en" => "Show results" }, value: draft.show_results)
Query(id: results, query: app.search(draft.text, 20), presented: draft.show_results,
empty: tr! { "en" => "No matches" }) |books| {
ForEach(items: books, key: id) |book| { Text(content: book.title) }
}
if !draft.show_results { Text(content: tr! { "en" => "Settings" }) }
}presented defaults to true. It is a Boolean expression in the surrounding scope, not a query argument: toggling it neither requests data nor advances the request version. While false, there is no result, status or retry control in layout, focus, accessibility or external control lookup. The subscription still follows argument changes, invalidation from #[reads] and replies. Showing it again presents its current state: ready data or an empty result immediately, a real pending load, or a failure with retry. This does not cache results per tab or argument set.
Removing the declaration (for example by putting the entire Query inside if draft.show_results) or closing its window ends the subscription. Another window owns a separate subscription.
A header that scrolls with the results
If the selector should scroll with the results, put it inside the success template’s ScrollView. To offer the same selector before the first answer, make QueryStatusHeader the first direct child of Query and call the selector component inside it:
Query(id: results, query: app.search(draft.text, 20), presented: draft.show_results) |books| {
QueryStatusHeader { browse_header(app: app) }
ScrollView {
browse_header(app: app)
ForEach(items: books, key: id) |book| { Text(content: book.title) }
}
}QueryStatusHeader takes one child, evaluated in the surrounding scope: it can use app and draft, not this query's books. To make it conditional, put if inside the header. It appears above the native progress indicator until the first answer, or above the native failure and retry controls if there is no previous answer. It does not replace those controls or start a second subscription.
A successful empty list or None counts as an answer. Once an answer is available, the status header is absent, including during a refresh or a failure that carries the previous answer. The query keeps its usual handling of data, empty results and errors. When presented is false neither layout is built. Omitting QueryStatusHeader leaves the default query UI unchanged.
Common motion and rail properties
The following properties are open only to layout elements for which ComponentSpec::moves() is true, and should not be added to nodes that do not accept motion, such as Window, navigation structures and slots. Each backend may have further capability restrictions.
| Property | Type |
|---|---|
appear |
Transition |
appear_delay |
Number |
disappear |
Transition |
reflow |
MotionToken |
hero |
HeroName |
hero_key |
KeyValue |
reveal |
hover |
animate |
MotionToken |
appearance |
light / dark |
tint |
ColorRole: the accent color of this part of the interface changes to that role, and the controls, selection states and links inside it are colored accordingly |
scroll_scale |
Number |
scroll_opacity |
Number |
scroll_origin_x |
Number |
scroll_origin_y |
Number |
nudge |
Bool |
nudge_key |
KeyValue |
nudge_scale |
Number |
nudge_motion |
MotionToken: how the element returns after a nudge, jelly when omitted; requires nudge or nudge_key |
reduce_motion |
Bool |
spin |
Bool: when true, rotates at a constant speed around its center; when false, stops at the angle it has at that moment |
spin_period |
Number: seconds per revolution, default 1, negative for counterclockwise; requires spin |
glow |
Number: a white glow that follows the pointer (a hovering mouse, or a finger held down) while it is within the element, with a radius of this multiple of the element's shorter side; it lights up even with other elements on top |
glow_opacity |
Number: the opacity at the center of the glow, greater than 0 and at most 1, default 0.4; requires glow |
blur |
Length: blurs the element's picture by this radius (points), without going beyond the element's bounds and corner radius; can follow state, and with animate changes with its motion (bound_blur: implemented on all six targets) |
opacity |
NumberValue: element opacity from 0 to 1; can follow state, and with animate changes with its motion (elements with their own opacity property — Marquee, Skeleton, Shape, Series, Pattern — apply it directly) |
stagger |
Number |
idle_area |
Number: the number of seconds the mouse must rest here before the window goes idle; when there are idle areas, the mouse resting elsewhere in the window does not make the window idle (once it leaves the window, the window goes idle after its idle_after) |
at |
NumberValue |
from |
NumberValue |
to |
NumberValue |
skeleton |
Bool: when true, replaces the element (after a 120 ms anti-flicker delay) with a compile-time skeleton projected from its own UI tree, and fades real content in over 150 ms once false; not valid on Query or Skeleton |
skeleton_count |
Number: whole number 1–30 controlling how many repeated placeholder items ForEach, List, Table, PreviewList or Query project |
Current components that do not accept the common properties above: WindowSet, Window, Detail, SidebarItem, Section, Slot, Pages, PageContent, Destination, Tab, Layout, MenuItem.
scroll_origin_x and scroll_origin_y are the point that stays still when scroll_scale enlarges the element, taken as a ratio of the element's width and height from 0 to 1, default 0.5 (the center), like CSS transform-origin. at, from and to are used for positioning in a Rail; stagger is used only in Column, Row, Grid, Stack, ForEach and List, which support staggering. The existence of a common property does not mean that it is meaningful in every container.
Popover state and message input
The bubble of PopoverButton(panel_appearance: window) follows the window (the app's appearance choice or the system's), while the trigger button keeps the appearance of the region it is in. When omitted, the bubble inherits the region it is in; it also responds to appearance changes while it is open. panel_appearance: surface chooses according to the current platform style: with a specified background color it follows the window, and a native material bubble inherits the region it is in, so that a glass bubble above a video keeps its dark look and light text. On macOS without a specified background color, the system bubble material is kept (Liquid Glass on systems that support it). On Windows without a specified background color, it is the system's in-app acrylic, which likewise inherits the appearance of the region it is in and is confined to the window. All targets support style! { PopoverButton { background: color(light: "#F2F2F2", dark: "#1E1E1E"), foreground: text.primary } }; the colors apply to the entire bubble surface and its content, not to the trigger button.
PopoverButton(open: app.panel) { … } => app.set_panel(app.panel) replaces the identical state expression in the action with the new open/closed value; opening, dismissing by clicking outside and closing with Escape all go through this action. When open is omitted, presented: draft.panel can still be used, or the component can keep its own state.
On macOS, clicking outside a TextInput releases focus and keeps the draft, and does not block the normal action of the clicked control. Clicking inside still positions the cursor and selects text. submit: clear clears and releases the keyboard immediately after submitting; an input field that waits for server confirmation should use clear_key and increment the number on success, keeping the text on failure. clear_key does not clear on first mount; currently only the SwiftUI backend implements its runtime behavior.