TILE lays out a screen with a few components instead of hand-written flex and grid classes. A Panel is the shell of
a pane, ScrollArea makes its body scroll, and the layout primitives, such as Flex, Grid and Container, arrange
what is inside.
A pane with a fixed header and a scrolling body is easy to get wrong by hand. It takes a flex column, a
min-height: 0 and an overflow, each on the right element, and if you miss one, the whole page scrolls where the
pane should. With TILE, you compose the pane from a panel and a scroll area instead.
A panel has three rows.Panel.Root is a grid whose rows are Panel.Header, Panel.Body and Panel.Footer. The
header and footer take the height of their content, and the body takes the rest.
Use a panel as the outer shell of a pane. It fills its parent, so its parent needs a height.
The height chain. The height chain is the run of elements from the panel down to the content that scrolls. For
the body to scroll, each of them must pass its height down.
Panel.Body asChild makes the ScrollArea.Root the body itself, and ScrollArea.Viewport asChild makes the content
the viewport. This way, no extra element breaks the chain.
The plank host: fills its parent, sets data-size and a level for its subtree, and is the pane's
query container, so its header, body and footer collapse at the same pane width.
The top row on the bar aspect, which steps off whatever level hosts the panel; it sizes to its content, so it takes
no space when empty and one block when it holds a Toolbar.Root.
role=toolbar with the roving focus that role promises (decision 9); items that overflow scroll along its axis in a
thin ScrollArea whose bar shows on hover, the toolbar itself being the viewport.
role=toolbar with the roving focus that role promises (decision 9); items that overflow scroll along its axis in a
thin ScrollArea whose bar shows on hover, the toolbar itself being the viewport.
The top row on the bar aspect, which steps off whatever level hosts the panel; it sizes to its content, so it takes
no space when empty and one block when it holds a Toolbar.Root.
The growing middle row, a plain slot: it neither scrolls nor adds a gutter, so content composes its own frame
(asChild onto a ScrollArea.Root around a Container, or a canvas that fills the row). The first Container under it
takes the panel's gutter unless it names one. Like the header and footer it is no query container, so its content
collapses against the panel.
Grid part (decision 5): every prop is a data-* attribute resolved by theme/container.css.
Container
gutter?: Layout.Gutter | undefined
inherit makes the container a subgrid of its parent's tracks; any other value starts a fresh template. Unset, it
is the enclosing Panel.Body's gutter for the first Container under the Body, and inherit everywhere else.
Calls a defined callback function on each element of an array, and returns an array that contains the results.
@param ― callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
@param ― thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
Text whose first line is centred in a block, so it lines up with a Block or control beside it however many lines
it wraps to. Renders a <p>; asChild puts the metrics on a heading or other text element instead.
Text whose first line is centred in a block, so it lines up with a Block or control beside it however many lines
it wraps to. Renders a <p>; asChild puts the metrics on a heading or other text element instead.
The growing middle row, a plain slot: it neither scrolls nor adds a gutter, so content composes its own frame
(asChild onto a ScrollArea.Root around a Container, or a canvas that fills the row). The first Container under it
takes the panel's gutter unless it names one. Like the header and footer it is no query container, so its content
collapses against the panel.
role=toolbar with the roving focus that role promises (decision 9); items that overflow scroll along its axis in a
thin ScrollArea whose bar shows on hover, the toolbar itself being the viewport.
role=toolbar with the roving focus that role promises (decision 9); items that overflow scroll along its axis in a
thin ScrollArea whose bar shows on hover, the toolbar itself being the viewport.
The plank host: fills its parent, sets data-size and a level for its subtree, and is the pane's
query container, so its header, body and footer collapse at the same pane width.
Root>
40
);
41
ContactsPanel puts four parts between the panel and its rows: the body, the scroll area’s root, its viewport and a
Layout.Container. The two asChild lines fold them into two elements. Each row’s icon sits in a Layout.Block, in
the rail that gutter='rail' leaves.
Layout primitives. A layout primitive is one of the six components in the Layout namespace, which place
content and own its spacing. Flex, Grid and Container take asChild, so you can lay out a semantic element such
as a <header> or <ul> without an extra wrapper. Block, Columns and Separator do not take it. The table says
what each one arranges and when to use it:
Primitive
Arranges
Flex
Children along one axis. Use it for a row of controls or a stack of fields. Its props are column, gap, align, justify, wrap, grow and center
Grid
Children in tracks. Use it when columns must line up, or when one track has a fixed size. cols={3} gives equal columns, cols={['min', 'fill']} a label column and the rest, and cols='subgrid' the parent’s tracks
Container
Content between two gutters, so rows line up with the panel’s edges. Use it for the rows of a panel’s body. gutter='rail' leaves room for an icon column
Block
One slot in the rail of a Container, sized so an icon and an icon button line up. Use it for the icon at the start or the end of a row
Columns
A horizontal run of as many columns as fit, which scrolls one column at a time. Use it for a drill-down, where each choice opens a column beside the last
Separator
A rule between groups. Use it to part two groups of rows or of controls
A gutter is the space at the start and at the end of the rows of a Layout.Container.
gap takes steps, not numbers.Flex and Grid take gap='xs' through '2xl', plus 'form' and
'form-section' for the spacing between fields. Steps keep the spacing the same from one screen to the next. A
literal such as gap-2, passed in classNames, still applies, and that screen then drifts from the rest.
Width and height use physical classes: w-*, h-*, min-w-* and max-h-*. A physical class names an axis of the
screen, which is the same in every language.
Spacing that depends on the reading direction uses logical classes: ps-* and pe-* for padding, ms-* and
me-* for margin, and start-* and end-* for insets. A logical class names the start or the end of a line, so
it flips in a right-to-left language.
By default, Flex sets no align, so children stretch as they do in plain CSS.
grow on a Flex or Grid makes it take the slack of its parent and clip what overflows. A child that scrolls
needs that from its parent, as a link in the height chain.
If you put a wrapper <div> between Panel.Body and the scrolling content, it breaks the height chain, and the
content grows instead of scrolling. Use asChild instead.
Components such as forms and lists own their spacing. If you add padding around them, you double it.