This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index at /llms.txt, or add .md to any page's URL.

Styling and layout

Use CSS names and values: font-size, background-color, object-fit, text-overflow, and line-clamp. There are no React Native aliases such as fontSize, resizeMode, or numberOfLines. A style attribute is name=value, not a JavaScript style object.
A bare box uses CSS defaults, including display: block, box-sizing: content-box, flex-direction: row, and flex-shrink: 1. row and column are convenience flex containers. Do not infer flex behavior from arbitrary parenthood, and do not assume border-box sizing. Set it when it matters.
Numeric dimensions normally mean pixels. Unit-bearing values and keywords are strings: width="50%", height="auto", padding-top="env(safe-area-inset-top)", width="calc(100% - 24px)", and CSS's min(), max() and clamp() over px, percentages, the safe-area insets and viewport lengths: padding-bottom="clamp(15px, env(safe-area-inset-bottom), 60px)", bottom="calc(max(15px, env(safe-area-inset-bottom)) + 44px)", width="min(50%, 600px)". env() is the screen's safe area; var(--exact-safe-area-inset-top) (and -right, -bottom, -left) is the one where the box is: inside a route, its bars included, so margin-top="calc(-1 * var(--exact-safe-area-inset-top))" takes a background up under the navigation bar (LLP 1123 D9). A route is cleared of its bars by itself, the clearance added to its padding unless that padding reads the inset; -exact-safe-area on the route turns it off per edge (D3, D4). Supported values are property-specific; this is not an unrestricted browser stylesheet. The compiler and kernel reject unsupported names or values. line-height=1.5 is a ratio; line-height="24px" is fixed.
A reusable style contains literal style values:
contract
style Panel
padding=16 gap=8 border-radius=12
background-color="-exact-secondary-background"
component App
view
column class=Panel padding=24
text "A padded panel"
The element's own attributes override its class. class=(c1 ? Active : c2 ? Pending : none) chooses among named styles (or none, up to 16 arms; constant conditions fold statically). This is not CSS selector matching, a cascade, or a string of multiple class names. Put computed values on the node; style bodies are constant. Style rows omitted by the selected style revert to their defaults rather than keeping another style's previous value. A style can also hold the props backgroundMaterial, glassGroup and buttonStyle. In a conditional class, each prop must be set in all arms or none, unless the element supplies its own value. Use backgroundMaterial="none" to remove a material.
Useful property families include flex/block layout; sizes and min/max sizes; padding, margin, and gaps; borders and radii; overflow and clipping; text metrics and wrapping; color and gradients; transforms, shadows, filters, and animation; and SVG presentation properties. The actual declaration inventory is kernel/tables/schema.json, with authored names and shorthands resolved by tags.rs. Use those instead of assuming every CSS property or unit exists. A value is held to one grammar on every host, a computed one too: background-image takes linear-, radial-, conic- and repeating-linear-gradient() with percentage stops; linear/radial stops also take px lengths. A template naming url( fails the build, and a computed value that is refused at run time is dropped and journaled on the web as on a Mac (invalid background-image value …; unset), never painted by the browser alone.
backdrop-filter accepts none, one blur() and/or one saturate() in the order written. For example, backdrop-filter="blur(12px) saturate(1.14)" blurs the backdrop, then increases its saturation. saturate(0) is grayscale; saturate(180%) is the same as saturate(1.8). A function may appear only once. Web, macOS and the painted hosts (Android 12 and later, Windows and Linux) apply these functions; iOS/tvOS use the fixed .light system material approximation. macOS samples only the parent layer's subtree and clips children to the filter's border box, so make a glass panel a sibling of what it covers (a floating composer beside its scrolling transcript), not a child of an empty wrapper. backgroundMaterial wins when both are present, and backdrop filters do not animate.
Bound scroll containers. A typical full-height column gives its scroller flex=1 min-height=0; an isolated scroller can use a numeric height. A scrolling area as tall as all its children is not a usable scrollport. The bake checks measured layout as well as the compiler's structural checks.
Use aria-label, roles, and other admitted ARIA attributes where content alone does not name a control. Keep accessible labels separate from driver testIds. A literal role must name a concrete ARIA role, or it is refused. They mean on every host what they mean in a browser: aria-hidden takes a subtree off the tree and out of its ancestors' names; role="checkbox", "radio" or "switch" with aria-checked is that control, role="img" with a label an image; aria-labelledby (the ids of the elements whose text names this one, as a radiogroup names itself by its visible heading) wins over aria-label; aria-describedby (the ids of the elements whose text describes this one) and aria-description are its description. aria-invalid, aria-required, aria-haspopup and aria-current (a navigation link's "page", a wizard's "step") take their ARIA words or a bool; UIKit has no property for those four, so iOS exposes the first three not at all and a pressable's (a button's, a link's) aria-current other than false as its selected trait, as aria-selected is. aria-activedescendant names the active option while a field keeps focus (combobox recipe); the web exposes it, and other hosts carry it without using it. A data table is HTML's table: an optional caption, then thead, tbody and tfoot row groups of trs (or trs alone, which are a tbody of their own, as HTML's parser makes them), each tr holding th header cells (scope="col" or "row") and td cells, any cell with colspan and rowspan (rowspan=0 reaches the end of its row group). Rows and cells may come from a for. A sortable column's th takes aria-sort ("ascending", "descending", "none" or "other"). The web and macOS expose the sort direction to assistive technology. On the Mac, unstyled rows with one row of text headers and unspanned cells give the table AppKit column headers. Put press on a th to sort the rows in your app and set aria-sort to show their order. People can drag a divider to resize a column. Its contents wrap at that width, which a named window restores when reopened. Use appearance="none" on the table to keep the authored presentation.
Terms and their descriptions are a dl of dt terms each followed by its dd descriptions. The browser lays out the HTML elements. On native hosts the kernel lays a table out as a grid. Its columns size to their content until resized. Where columns share width (a span wider than the columns it covers, a table narrower than its content), the grid shares it equally and the browser in proportion to the columns' widths, so unequal columns can differ by a few points (LLP 1153 D7.3). macOS, Linux and Windows expose a table's, a row's and a cell's roles, and a description list's; iOS announces a table as a data table and a dl as a list, its rows and cells with no role of their own. A drawn range — role="progressbar", "slider", "meter", "scrollbar" or "spinbutton" — takes aria-valuenow, aria-valuemin and aria-valuemax (numbers; ARIA's 0 and 100 where a bound is unsaid, and none for a spinbutton) and aria-valuetext: it is one element, its children unread, and its value is the platform's (UIKit's accessibilityValue as a percentage, "30%", a spinbutton's as its number, "3", or the text; AppKit's value, minimum and maximum, the text its description). A slider or spinbutton is adjusted by its own keys: give it tabindex=0 and a key handler for the arrows. A screen reader's increment and decrement (VoiceOver's swipe up and down, TalkBack's and Windows' adjust) are then a keydown and a keyup at it, as Safari sends them to an ARIA slider: ArrowUp and ArrowDown for a spin button or an aria-orientation="vertical" slider, else ArrowRight and ArrowLeft, swapped where the slider's direction is rtl (the document's, unless the slider says its own). A progress or input type="range" says its own value. Leave font sizes, colours and control metrics unsaid and the platform supplies them; what you set on a node wins.
Declare bundled fonts at file scope:
text
font "Brand" = "assets/brand.ttf"
font "Body"
400 = "assets/body-regular.ttf"
700 = "assets/body-bold.ttf"
400 italic = "assets/body-italic.ttf"
font "Flex"
100 1000 = "assets/RobotoFlex.ttf"
These are syntax examples requiring real font files. Apply with font-family="Brand". Respect the font's license and use the app's asset layout. A face is an @font-face rule: one weight, or for a variable file a range (100 1000), which draws every font-weight in it on the file's wght axis. The one-line form takes the file's own ranges, so a variable file declared with it covers all its weights. A file's wdth axis is its font-stretch range: font-stretch="75%" (or condensed) draws narrower type on it, and on system-ui San Francisco's widths on Apple. Any other axis is set by tag, as CSS sets it: font-variation-settings="'GRAD' 150, 'wdth' 60". A tag it names wins over font-weight and font-stretch for that axis; prefer those two where they say it. Text fields and Canvas 2D's font take the width too. A file's opsz axis follows the font size; font-optical-sizing="none" keeps the face's own.
font-variant-ligatures turns the face's ligatures on or off, as CSS does: none keeps a ligating font such as Fira Code from joining :// or -> in an address or code, and the other keywords (no-contextual, discretionary-ligatures, …) name one kind each. Text fields take it too, including Android's native fields. A terminal draws no ligatures; UIKit's grouped list cells and content regions keep the font's own; widgets and the watch refuse it.
Any other OpenType feature of the face is set by tag, as CSS sets it: font-feature-settings="'cv05', 'cv11', 'zero'" draws Inter's tailed l, single-storey a and slashed zero. A tag alone or on is 1, off is 0, and a larger number, up to 65535, picks an alternate ('salt' 2); a tag the face lacks does nothing. It is an element's property, not a font declaration's, and it is inherited: it applies to the text under the node it is on, in whatever face that text is drawn. Set it on the root to cover the app, or on the elements that use the face when another face under the same ancestor has a feature of the same tag (cv05 is a different letter in each face). Up to sixteen features are named in one value. It applies after font-variant-numeric and font-variant-ligatures and wins for a feature it names, so 'tnum' 0 undoes tabular-nums; prefer those properties where they say it. It reaches text and text fields, including Android's native fields, where font-variant-ligatures does.
Is this helpful
Last updated November 30, 2026
Exact Docs