Reference
Reference
146 built-in elements by family, every command, setting and design token — each read from the compiler itself, so what these pages list is exactly what it accepts.
Language and tools
Expressions
Language
Built-in functions and values
Language
Grammar
Language
Services and requests
Language
Runtime API
Language
Command line
Tools
Configuration
Tools
Design tokens
Tools
Project structure
Tools
Browser support
Tools
Glossary
Tools
Library
Tools
Editors
Tools
Layout
Container
Centred wrapper with a maximum width and horizontal padding.
Row
Horizontal flex layout. It stays a row at every width unless .stacks or a responsive direction says otherwise.
Column
A child of the 12-column grid, spanning span columns.
Grid
CSS grid with a fixed number of columns.
Stack
Vertical flex layout.
Spacer
Vertical space; md when no size is given.
VirtualList
A scrolling box that draws only the rows in view of the one keyed for inside it — for a tree, search results or a diff of thousands of rows.
Splitter
A handle that sets the size of a region beside it: dragged, between min: and max:; double-clicked or Enter, back to reset:; the arrow keys move it.
Divider
Horizontal rule.
Masonry
Its children in columns: columns, each placed under the last in its column, keeping its own height.
AspectRatio
A box that keeps its shape as its width changes — ratio: 16 / 9 — its child filling it: a picture, a video, a frame.
ScrollArea
A box that scrolls within height:, with a thin scrollbar, its edges fading where there is more, and a Tab stop so a keyboard can scroll it.
Center
Its children in the middle of it, across and down.
Sticky
A box that sticks to the top of its scrolling parent (offset: below it) as the page scrolls past, marked data-stuck while it is stuck.
PanelGroup
Panels side by side (or .vertical, one above another) with a handle between each two that resizes them: dragged, or the arrow keys on it. bind: holds their sizes in percent — a persist keeps them across visits — and on resize(e) hears them as e.detail.
ClientOnly
Its block drawn in the browser alone, never in the static paint, a template or a PDF: a clock, the reader's own data. A placeholder { … } block is what those show in its place.
AppShell
An app's frame: AppShell.Header across the top, a Sidebar down the start (a drawer on a narrow screen), the Router's page beside it, and an AppShell.Footer.
Host
A bare node handed to somebody else's code, with a lifetime. mount: runs with the node each time it is made, update: again whenever the state it reads changes, and cleanup: when the page, branch or list item it belongs to leaves. Every other element takes the same three.
Portal
Its block, drawn into a node somebody else's code owns: an element a script hands over, or a ref: handle. When into: names another node the block moves there with its nodes and state; null keeps it aside until a node comes back; it goes when the page, branch or list item it is written in leaves. What is inside belongs to where it is written: its handlers, emit and lifetimes.
Element
A custom element a script defines, placed by its tag: Element("stripe-pricing-table", publishableKey: key) { on ready { … } }. Every named argument is an attribute, every on handler an event it fires, and the block its children.
Navigation
Navbar
Top navigation bar with brand, links and action areas.
Sidebar
Side navigation. A Sidebar.Item whose to matches the current route is marked .active and aria-current="page".
Link
Client-side navigation link; its label or its block is the link text.
Tabs
Tab strip switching between its pages: the arrow keys move between the tabs (the other way round in a right-to-left page), Home and End go to the ends.
Breadcrumb
Breadcrumb trail. An item without to is the current page.
Menu
A menu above everything: opened by its trigger: button, or by visible: at an anchor: or a point at: — a context menu. Escape, a press outside or a choice close it, write false back to visible: and fire on close.
NavigationMenu
A site's main navigation whose entries open panels (a mega menu) as disclosures: one open at a time, the arrow keys along the row, Down into a panel, Escape, a press outside or the focus leaving closes it.
Menubar
File, Edit and View, as in a desktop app: one Tab stop, the arrow keys along it; Down or Enter opens a menu, and with one open Left and Right open the one beside it.
ContextMenu
What it wraps, and a menu a right-click, a long press, the menu key or Shift+F10 inside it opens where it happened.
BottomNavigation
A phone's tab bar along the bottom of the screen: each entry an icon over its words, at least 44px to press, clear of the home indicator (the safe-area inset); the current route's is marked.
PrevNext
The pages before and after this one in an ordered set — a guide's chapters: each a link that says which way it goes and the page's title.
OnThisPage
The page's headings as links, the one being read marked as the reader scrolls: a table of contents beside a long page.
Pagination
Pages of a list: Previous, the first and last pages, those around the current one with a gap for the rest, and Next. The current page is aria-current="page"; bind: holds it, from 1.
Stepper
Steps taken in order — an account, then billing, then a summary — with each step's state (done, current, an error) and the current step's block shown. bind: holds the current step, from 0; .linear keeps a step out of reach until the ones before it are passed.
CommandPalette
A dialog of everything a reader can do or go to, filtered as they type: the arrow keys go through what matches, Enter runs it (on select) and closes. open: is the state that shows it.
Routing
Data display
DescriptionList
Terms and what they are (<dl>): a column of pairs, or .grid, each term beside its value.
Timeline
Events in order (<ol>), each a dot on a line, its title, its time and its block.
AvatarGroup
Avatars overlapping in a row: past max: the rest are one +3.
Item
A row of a list, a settings page or a search's results: Item.Media at its start, its title: and description:, then its block, and Item.Actions at its end.
Sparkline
A tiny chart in a line of text — a line, or .bar — of a list of numbers, drawn as an SVG when the page is built.
RelativeTime
A moment as 3 minutes ago, kept current, with the exact time on hover (<time>).
Card
Card surface with optional header, body and footer sections.
Table
Data table. Cells inside Table.Head render as <th scope="col">; caption is the table's accessible name, visually hidden.
List
List of its children; ordered for a numbered list.
Badge
Small status label.
Tag
Compact chip.
Avatar
A picture of a person, or their initials.
Tooltip
Shows text above everything when its child is hovered (after delay:) or focused from the keyboard.
Tree
Nested items — files and folders, an outline — as a tree a keyboard can work: Up and Down through what shows, Right to open and go in, Left to close and go out (the other way round right to left), Home and End, a letter. row(item) { … } draws each; bind: holds the chosen item's key, or a list of keys with .multiple.
DataTable
Rows of records with their columns declared once: a column sorts when it is .sortable (its header a button, aria-sort saying which way), cell(r) { … } draws a cell, empty { … } shows when there are no rows, and bind: chooses rows (a list with .multiple, a box for each and one for all).
Chart
A chart drawn as vector graphics when the page is built: bars, lines, areas, a pie or a donut over a list of records.
QrCode
A QR code for a URL or any text, drawn as vector graphics when the page is built.
Content
Callout
A note set apart from the text around it — .note, .tip, .important, .warning, .caution — with an icon and a title, as GitHub's alerts are. Its text is the positional, in Markdown (code, **bold**, a link), or its block.
Kbd
A key or a combination, written as this system writes it: Kbd("mod+k") is ⌘K on a Mac and Ctrl+K elsewhere.
EmptyState
What a list or a page shows when it has nothing yet: an icon, a title, a sentence and, in its block, what to do about it.
Stat
A figure with its label — revenue, sign-ups — and how it moved: Stat("Revenue", value: total, format: .currency, change: 0.124). count: counts to a new value.
CodeBlock
A block of code with a bar above it: a file name, a copy button (.copy), and line numbers (.lines). language: colours it, as on Code; highlight: marks lines; files: makes it a tab for each file.
Chip
A compact label — a filter, a tag, a person — that can carry an icon, be pressed (selected:, with on click), and be removed (.removable, with on remove). Tag is the one that does none of it.
VisuallyHidden
Words for a screen reader only: Link(…) { Text("Docs") VisuallyHidden("(opens in a new tab)") }.
Accordion
Sections a reader opens one by one, each a native <details>: Accordion.Item("Shipping") { … }. .single keeps one open at a time.
Form
ColorPicker
A colour, chosen from swatches: (each a button, the chosen one pressed), with the browser's own picker, or typed as hex; bind: holds it as #rrggbb.
TransferList
Two lists side by side — what can be chosen and what is — with buttons that move the selected across, or all of them; bind: holds the keys of the chosen.
Editable
Text that turns into a field when pressed: Enter or leaving keeps what was typed, Escape puts it back; bind: holds the text.
Input
Text field. With label, hint or error it is a labelled field.
Select
Drop-down of Select.Option children.
Checkbox
Checkbox bound to a boolean state.
Radio
One choice of a group; every radio bound to the same state is one group.
Switch
On/off toggle bound to a boolean state.
Slider
Range input. aria-* and its other attributes reach the input; with aria-valuetext the raw number is not shown beside the track.
DatePicker
A date field: the reader picks a day, and the bound state holds a Date.
FileUpload
File input; bind: holds what was chosen, and on change hears it.
Form
Groups controls; on submit runs when it is submitted, and the page never navigates away.
Textarea
Several lines of text. With label, hint or error it is a labelled field; with maxLength it counts what is left.
Field
A label, a hint and an error around a control of your own: the first control in its block is named by the label and described by the hint and the error, and marked invalid while there is one.
Fieldset
Controls that belong together — an address, a choice of plan — under a legend that names them.
InputGroup
An input drawn as one box with what goes beside it: an icon, InputGroup.Addon("https://"), a button, or InputGroup.Clear, which empties the input and gives it the focus back.
RadioGroup
One choice of several, as native radio buttons under a legend: the arrow keys move between them, and .cards draws each as a card with its hint.
NumberInput
A number with − and + beside it: the arrow keys step it, PageUp and PageDown by ten steps, and it stays between min: and max:.
Calendar
A month as a grid of days, chosen with a press or the keyboard — the arrows by day and week, PageUp and PageDown by month, Home and End to the week's ends — one day, a range, or several. bind: holds a Date, a { start, end } with .range, a list with .multiple.
Listbox
A list of options always shown, one chosen (selection follows the arrow keys) or, .multiple, several: Space chooses, Shift with an arrow takes the next one in too, Ctrl or ⌘ with A takes them all; a letter goes to the next option that starts with it.
Combobox
A text field that offers what matches as the reader types: from options:, or search: asked of a server. The arrow keys go through the offers, Enter takes one, Escape closes them; .multiple keeps several, each a chip Backspace takes back. option(o) { … } draws an offer; empty { … } shows when nothing matches.
CheckboxGroup
Check boxes under a legend whose bind: is the list of the values ticked, with all: a box above them for every one at once — ticked when all are, mixed when some are.
InputOTP
A one-time code typed a digit to a box: the focus moves on as each is typed and back with Backspace, and a code pasted into any box fills them all; the browser offers the code it was sent (autocomplete="one-time-code").
TagInput
Words typed into a field, each a chip once Enter or a comma ends it; Backspace in the empty field takes the last back, and each chip has a button to take it out.
Rating
Stars, as radio buttons a screen reader hears as a choice of one to max:: the arrow keys move between them; .half takes halves; .readonly only shows.
DateRangePicker
A first and a last day, chosen in two months side by side that a button opens, or by a preset: presets: [.last7, .thisMonth]. bind: holds { start, end }.
Feedback
HoverCard
A preview card at a link or a button: shown after delay: ms of hover, at once on focus; it stays while the pointer is on it, and goes when the pointer leaves both, on Escape or on a press outside.
LoadingOverlay
A region covered while it is busy: aria-busy on it, its content out of reach, and a spinner with label: over it — the region, not the page.
Tour
A tour of the page while open: holds: each step in a card at its target: (a ref:), lit through a cut-out in the dimmed page, with Back, Next and Done; Escape ends it and writes false back. on finish hears Done, on close any end.
ConsentBanner
The reader's say over the scripts that track them: shown until they choose, Decline as easy as Accept, and the choice kept. Accepting loads the meta.scripts entries marked "load": "consent", then and on every later visit; nothing loads before.
ConsentSettings
A button that asks the reader again — a footer's "Cookie settings": it forgets their answer and shows the ConsentBanner. A script already loaded stays until the page is loaded again.
CircularProgress
A ring that fills to value: of max:, announced as a progress bar; with no value:, it turns, for work of no known length. Its block is drawn in the middle.
Meter
A level against its range (<meter>): a disk's use, a password's strength. Past high: or under low: it says so in its colour; optimum: says which end is good.
Popconfirm
A question beside the button in its block before what it does: the button opens it, on confirm hears yes, on cancel no or Escape; the focus starts on the answer that loses nothing.
Alert
Inline notice; a danger or warning one is announced as an alert.
Toast
Temporary notification.
Modal
Modal <dialog>, opened by a state flag; the browser supplies focus trapping and Escape. on close runs when it closes, however it was closed, and the focus goes back to what had it.
Popover
A layer at a control: drawn above everything, placed against its anchor:, closed by Escape or a press outside, which write false back to visible: and fire on close.
Dialog
Confirmation <dialog>, opened by a state flag. on close runs when it closes, however it was closed, and the focus goes back to what had it.
AlertDialog
A <dialog> that asks before something that cannot be undone: role="alertdialog", its body read out with its title, and closed by Escape or its own buttons, not a press outside. For a question asked from a handler, await ask(…) draws one.
Sheet
A modal <dialog> that comes in from an edge: the bottom (a phone's filters, a share list) or the start or end of the line. Dragged by its handle or heading toward its edge it closes; a bottom sheet with snap: points settles at the nearest.
Spinner
Loading indicator, announced as a status.
Progress
Progress bar; a value that reads state moves with it.
Skeleton
Placeholder shape shown while content loads.
Actions
Fab
A round button floating at the bottom of the screen for the page's main action; with Fab.Actions in its block it opens them instead (a speed dial).
BackToTop
A button that appears once the page has scrolled past after: px, and takes the reader — and the focus — back to the top.
CopyButton
A button that copies value: to the clipboard, says Copied for a moment, and tells a screen reader so.
ThemeToggle
A button that switches the page between light and dark, over setTheme: a moon in a light page, a sun in a dark one, named for the theme it switches to. The reader's choice is kept.
LocaleSwitch
One button for each of i18n.locales, each written in its own language (English, العربية), the current one pressed; a press is setLocale.
Toggle
A button that stays pressed while its state holds — bold in an editor, a filter that is on: aria-pressed, a press flipping bind:.
ToggleGroup
Buttons of which one is chosen — a view switcher, a segmented control — or, .multiple, several: one stop for Tab, the arrow keys inside it, each aria-pressed. bind: holds the chosen value: (a list with .multiple).
Button
A button: its label or block is what it shows, on click what it does.
IconButton
Icon-only button. label is its accessible name, never visible text.
ButtonGroup
Buttons joined into one row.
Dropdown
Button that opens a menu of Dropdown.Items.
Media
Lightbox
Every picture in its block opens, on a press or Enter, full screen: the arrow keys and a swipe go between them, a double press or + zooms, Escape closes and the focus goes back. A picture's data-full: is the file it opens, else its largest size.
Gallery
Pictures in a grid of columns: (unset, as many as fit), each cropped to one shape — ratio:, unset square. In a Lightbox, each opens full screen.
Image
Image; alt is required for accessibility (rule A01). Given an image the program declares, it becomes a <picture> with every width the build wrote.
Video
Video player. Without captions it draws an A09 warning: a video nobody can hear is a video nobody can follow.
Audio
Audio player. transcript links what was said, which is what a reader who cannot hear it needs.
Frame
Another page, shown inside this one: an iframe — the page at src:, or the HTML srcdoc: gives it, sandboxed as sandbox: says. on message(m) hears what that page posts to this one (m.data), and nothing any other page posts. Without title: it draws an A17 warning: a frame is announced by its title.
Icon
One of the built-in SVG icons, rendered inline.
Carousel
Slide track with named controls and dots; optional autoplay.
Typography
Highlight
Text with every match of query: marked (<mark>), as a search's results show what was found; the case is ignored.
Text
A paragraph of text. {…} in the string reads state and stays live.
Heading
Heading; level picks the tag (h2 when none is given).
Code
Inline code, or a code block with block; language: colours it.
Markdown
Markdown text rendered as HTML: headings, paragraphs, lists, quotes, code, links, emphasis. The text is escaped first, so HTML in it is shown, not run, and a link or picture whose URL a browser would run is drawn as its words. .inert is for text somebody else wrote.
Unsafe
The one door for markup a page did not write. It has a single part, Unsafe.Html.
Blockquote
Quotation: the text, or its block as the quoted content.
TableOfContents
The document's headings with the page each lands on, each a link to it.
Document
Root of a PDF document: the paper, the margins and what the file says about itself.
Section
Groups content with spacing; on the web, a <section>.
Paragraph
Block of text with paragraph spacing.
Header
Repeated at the top of every PDF page (or those on: names), where page and pages are the page's number and the count; a <header> on the web.
Footer
Repeated at the bottom of every PDF page (or those on: names), where page and pages are the page's number and the count; a <footer> on the web.
Background
Drawn behind each PDF page's content, the size of the page: a cover, a band, a full-bleed picture.
Watermark
Large, faint, rotated text behind each PDF page's content.
PageBreak
Forces a new PDF page.
Slides
Presentation
Root of a slide deck; its children must be slides.
Slide
One slide, one PDF page; content is top-aligned and clipped at the bottom margin.
TitleSlide
Cover slide: title and subtitle, vertically centred.
SectionSlide
Full-bleed coloured band with a centred label.
TwoColumn
Two equal columns; takes exactly two Container children.
ImageSlide
Image slide with an optional caption.
On every element
Every element takes these props, and the HTML attribute families named on it (aria-*, data-*, and the global attributes such as id, class, title, role, tabindex).
| Prop | Type | Meaning |
|---|---|---|
animate: | one of its cases | Animation played when the element appears. Written as a flag,
|
exit: | one of its cases | Animation played when the element leaves. Written by name:
|
speed: | one of its cases | How fast its animation runs. Written as a flag,
|
duration: | String | Animation length, e.g. |
delay: | String | Wait before the animation starts |
easing: | one of its cases | How the animation is paced — a named easing, or any CSS timing function. Written by name:
|
stagger: | String | Delay added per item of a list, e.g. |
on: | one of its cases | When its animation plays. Written by name:
|
count: | String | How long the number it shows takes to count to a new value, e.g. |
shared: | String | A name this element keeps across a route change, so the browser carries it from one page to the next |
class: | String | Classes added beside the engine's, from the project's own stylesheets |
ref: | State | A handle on the element, usable as the element: |
drag: | Json | What it carries when it is picked up — by a mouse moved a few pixels, or a finger held still — and dropped on something with |
dragGroup: | String | Which drops it belongs to: a drag goes only to targets of its own group, so tabs and tree rows stay apart |
dropValue: | Json | What this target is, as a drag sees it: |
dropAxis: | one of its cases | Which way its list runs, for where a drop lands. Written by name:
|
dropInside: | Bool | A drop on its middle lands inside it — a folder, a container — as well as before or after. Written as a flag, |
roving: | one of its cases | One Tab stop for the group, and the arrow keys, Home, End and the first letters of a name to move inside it: a toolbar, a row of choices, a list. Written by name:
|
trapFocus: | Bool | While true, focus moves into it and Tab and Shift+Tab stay inside; when it turns false or the element leaves, focus goes back where it was. Written as a flag, |
mount: | (Element) -> Handle | Run with the element each time it is made — |
update: | (Handle) -> () | Run with the handle again whenever the state it reads changes: |
cleanup: | (Handle) -> () | Run with the handle when the element leaves — a route change, an |
| Event | Sends | Meaning |
|---|---|---|
on click | — | The element was clicked or activated |
on input | — | The value changed, on every keystroke |
on change | — | The value was committed |
on submit | — | The form was submitted |
on focus | — | The element received focus |
on blur | — | The element lost focus |
on keydown | — | A key went down; `e.key` names it |
on longpress | — | Held still for half a second; `p.x`, `p.y` say where. The click it ends with is not a click |
on swipe | — | A finger or a pen swept across it; `s.direction` is "left", "right", "up" or "down" |
on receive | — | Something with `drag:` was dropped on it; `d.value` is what, `d.position` "before", "after" or "inside" |
on dragmove | — | On what is dragged, while it moves: `d.over` is the target's `dropValue` or null, `d.position` where it would land |
on visible | — | It came into view: scrolled to, or drawn where the reader is looking. `v.ratio` is how much of it shows. A "load more" row's cue |
on key | — | One key, named: `on key("ctrl+k") { }` |
on keyup | — | A key came up |
on keypress | — | A character key was pressed |
on mouseenter | — | The pointer entered the element |
on mouseleave | — | The pointer left the element |
on dblclick | — | The element was double-clicked |
on auxclick | — | A button other than the main one was clicked; `e.button` is which — 1 is the middle, which closes a tab |
on focusin | — | Focus moved onto the element or something inside it |
on focusout | — | Focus left the element or something inside it |
on contextmenu | — | The context menu was asked for; `e.preventDefault()` keeps the browser's |
on mousedown | — | A mouse button went down over the element |
on mouseup | — | A mouse button came up over the element |
on mousemove | — | The mouse moved over the element |
on mouseover | — | The pointer moved onto the element or one of its children |
on mouseout | — | The pointer moved off the element or one of its children |
on pointerdown | — | A pointer — mouse, pen or touch — went down |
on pointerup | — | A pointer came up |
on pointermove | — | A pointer moved |
on pointerenter | — | A pointer entered the element |
on pointerleave | — | A pointer left the element |
on pointercancel | — | The browser took the pointer back, for a scroll or a gesture |
on touchstart | — | A finger touched the element |
on touchend | — | A finger left the element |
on touchmove | — | A finger moved across the element |
on wheel | — | The wheel or trackpad scrolled over the element |
on scroll | — | The element's content scrolled |
on reset | — | The form was reset |
on invalid | — | A control failed the browser's own validation |
on select | — | Text in a field was selected |
on copy | — | Something was copied from the element |
on cut | — | Something was cut from the element |
on paste | — | Something was pasted into the element; `e.clipboardData` holds it |
on dragstart | — | The element started being dragged |
on drag | — | The element is being dragged |
on dragend | — | A drag of the element ended |
on dragenter | — | Something dragged entered the element |
on dragover | — | Something dragged is over the element; `e.preventDefault()` allows a drop |
on dragleave | — | Something dragged left the element |
on drop | — | Something was dropped on the element; `e.dataTransfer` holds it |
on load | — | An image, video or frame finished loading |
on error | — | An image, video or script failed to load |
on play | — | A video or audio started playing |
on pause | — | A video or audio paused |
on ended | — | A video or audio reached its end |
on timeupdate | — | A playing video or audio moved on |
on animationend | — | A CSS animation on the element ended |
on transitionend | — | A CSS transition on the element ended |
on toggle | — | A details element opened or closed |
Icons
The names Icon(…), IconButton(icon:) and Sidebar.Item(icon:) draw; any other name shows as the word, and the compiler warns.
close
menu
search
home
user
settings
check
plus
minus
edit
trash
star
heart
bell
download
upload
eye
link
calendar
filter
chevron-down
chevron-right
chevron-left
info
warning
arrow-left
arrow-right
logout
copy
sun
moon
folder
folder-plus
folder-off
file
file-plus
refresh
alert-circle
clock
dot
diff
book
git-pull-request
pin
git-branch
more-horizontal
window-minimize
window-maximize
outline
help-circle
collapse-all
locate
chevron-up
globe
external-link
panel-down
panel-up
code
monitor
git-commit
play
layers
insert
grid
list
square
pill
image
sparkle
lock
type
pointer
reach
frame
line
pipette
comment
hand
zoom
ruler
eye-off
unlock
Older spellings
Names from earlier versions of the language that the compiler still accepts. New code writes the current name.
| Older spelling | Write instead | Meaning |
|---|---|---|
TabPage | Tabs.Page | One tab inside Tabs (the original spelling of Tabs.Page). |
Thead | Table.Head | Table header section (the original spelling of Table.Head). |
Tbody | Table.Body | Table body section (the original spelling of Table.Body). |
Trow | Table.Row | Table row (the original spelling of Table.Row). |
Tcell | Table.Cell | Table cell (the original spelling of Table.Cell). |
Option | Select.Option | One choice in a Select (the original spelling of Select.Option). |
Route | page | Maps a path to a page (the original grammar; pages now declare their paths). |