Row
A horizontal flex layout that places children side by side with consistent spacing. The horizontal counterpart to Stack.
Basic Usage
Gap Sizes
Justify Between
A common pattern for headers and toolbars: items at each end.
Alignment
A row of form controls
A row of fields does not line up on any single edge. A labeled field is taller than an
unlabeled one, and a field with a hint is taller still — so align="center" leaves the
controls apart, and align="end" fixes that until one field carries a hint.
align-fields makes the row three shared tracks — labels, controls, messages — and every
field hands its parts to them. A control sits on the control track whatever its neighbors
carry, and a submit button beside them stretches to match. An input, a
select, a textarea, a
date picker, a date and time picker, a
number input, a password input, a
phone field, a time picker, a
multi-select, a tags input, a
segmented control, a range slider, a
combobox and a translatable input
with one language hand over their own label, hint and error, and a field does it for the control it wraps. Anything else stands on the control track whole, as the button does: a checkbox, a radio, a toggle and a slider among them, since they set their label beside the control rather than above it. A checkbox, a radio and a toggle stand on the middle of that track, level with the middle of the fields beside them. The track is as tall as the controls on it, since a field's control takes no margin into it, so that middle is the control's own. A label hidden with hide-label still keeps its track, so the control stays on the line
of its neighbors.
A filter row often hides the labels of its selects and holds a date. The control of each field stands on the same line all the same:
| Mon | Tue | Wed | Thu | Fri | Sat | Sun |
|---|---|---|---|---|---|---|
| Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday |
|---|---|---|---|---|---|---|
| 30 | 1 | 2 | 3 | 4 | 5 | 6 |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 | 1 | 2 | 3 |
A checkbox or a toggle in such a row stands level with the middle of the fields beside it:
The other single-line fields hand over their parts the same way:
With the country code
It is opt-in because it changes the row's display model, and align / justify stop applying
once it is on — the row is a grid rather than a flex line at that point.
Below 48rem the row stacks, and that is the point rather than a limitation: three controls side by side on a phone are three sixty-pixel columns, which is not a narrower control but an unusable one. The shared tracks come back with the room to hold them, and nothing about the markup changes — the same row is a column on a phone and a line on a desktop.
The shared tracks use CSS subgrid, which is newer than WireKit's support baseline. Where it
is missing, the row still renders every field and every control; they simply line up the way
they do without this prop. Nothing depends on it.
More fields than one line holds
With wrap as well, an aligned row wraps instead of running past its container. The fields take
as many columns as fit at min, 14rem unless you set it, and every line of fields lines up on
its own controls, whatever the labels and hints on that line carry.
Without the lid
A child that is not a field, a submit button for example, sits at the bottom of its line. To put
it on the control track, wrap it in a field:
<x-wirekit::.
wrap="responsive" changes nothing on an aligned row, which already stacks below 48rem and holds
one line above it.
Content that follows a field in its cell, a button under a select for example, goes in the
field's after slot. It takes a fourth track below
the messages, on one line or wrapped, and only in a row that holds such a field.
Without subgrid each field is one box in its line, so a line of fields lines up at its bottom
edge instead of on its controls. The fields still wrap, and every control is there.
Wrapping
Enable wrapping for rows that may overflow. Two labeled buttons of a form need it too: in a
narrow card at 320 pixels, in a long language or with a reader's wider text spacing (WCAG
1.4.12), they run out of the card side by side. php artisan wirekit:doctor:props hints at a
row that holds a submit button and another button without wrap.
Wrapping only where it is needed
wrap="responsive" wraps below the md breakpoint and holds a single line above it. A row of
four or five items reads as one line on a laptop and as several on a phone, which is what a
dense toolbar or a KPI strip wants — the alternative on a narrow screen is a row that runs off
the side of the viewport.
A row does not wrap by default. responsive is something you ask for.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
gap |
string | 'md' |
Spacing: none, xs, sm, md, lg, xl, 2xl |
scale |
string | 'space' |
Which spacing ladder gap names a rung on: space (the default) or gap for the tighter --gap-wk-* ladder — see the note under Design Tokens |
align |
string | 'center' |
Cross-axis: start, center, end, stretch, baseline |
alignFields |
bool | false |
Line the row's form controls up on one line — see below |
min |
string|null | null |
With alignFields and wrap: the narrowest a column of fields gets before the row starts another line of them, as a CSS length. 14rem when unset |
justify |
string | 'start' |
Main-axis: start, center, end, between, around, evenly |
wrap |
bool | 'responsive' |
false |
true wraps at every width. 'responsive' wraps below the md breakpoint and holds one line above it — the shape a multi-item row wants on a phone |
as |
string | 'div' |
HTML element to render |
scope |
string|null | null |
Scoped personalization name |
Keyboard Interaction
This component is a layout wrapper. Keyboard interaction is delegated to its children.
Design Tokens
Same spacing tokens as Stack:
| Token | Default | Description |
|---|---|---|
--space-wk-xs |
0.25rem |
Extra small gap |
--space-wk-sm |
0.5rem |
Small gap |
--space-wk-md |
1rem |
Medium gap |
--space-wk-lg |
1.5rem |
Large gap |
--space-wk-xl |
2.5rem |
Extra large gap |
--space-wk-2xl |
4rem |
Double extra large gap |
The rung names are shared with a second ladder, and the values are not. scale="space" (the default) reads --space-wk-*; scale="gap" reads the tighter --gap-wk-* ladder, which uses the same xs…2xl labels with different values from md up and is what WireKit's own components read for spacing inside a component. The rung name alone does not tell you which — gap="md" is 1rem on one ladder and 0.75rem on the other — so changing scale without changing gap re-spaces the container on purpose, and swapping a raw utility for a rung of the same name re-spaces it by accident. See Two spacing ladders, same rung names.
| Rung | scale="space" (default) |
scale="gap" |
|---|---|---|
xs |
0.25rem |
0.25rem |
sm |
0.5rem |
0.5rem |
md |
1rem |
0.75rem |
lg |
1.5rem |
1rem |
xl |
2.5rem |
1.5rem |
2xl |
4rem |
2rem |