Columns
A fixed number of equal columns. On phones there are two at most, or one with stack.
import { Columns } from '@sypnia/ui/react'
Fields on one line
Three columns on wide screens; one on phones (stack), since a field needs the whole width there.
Code
import { Columns, Field, Input, NativeSelect } from '@sypnia/ui/react';
export default function Form() {
return (
<Columns cols={3} gap={4} stack>
<Field label="First name"><Input autoComplete="given-name" /></Field>
<Field label="Last name"><Input autoComplete="family-name" /></Field>
<Field label="Role">
<NativeSelect defaultValue="dev"><option value="dev">Developer</option><option value="ops">Operations</option></NativeSelect>
</Field>
</Columns>
);
} Four numbers
Four columns, and two by two on phones.
Problems3−2 since Monday
Users affected128+40
Errors1.2K
Median time84ms
Code
import { Columns, Stat } from '@sypnia/ui/react';
// Four columns on wide screens, two on phones.
export default function Stats() {
return (
<Columns cols={4} gap={4}>
<Stat label="Problems" value="3" delta="−2 since Monday" trend="good" />
<Stat label="Users affected" value="128" delta="+40" trend="bad" />
<Stat label="Errors" value="1.2K" />
<Stat label="Median time" value="84" unit="ms" />
</Columns>
);
} When to use it
Use it when
- A form row with two or three fields.
- A row of stats or a fixed layout of panels.
Do not use it when
- Cards that should reflow by width: that is a Grid.
- Two panes the person resizes: that is a Split.
For everyone
- Order in the code is the order on screen and for screen readers, in every width.
Props
| Columns | Type | Default |
|---|---|---|
as | ElementType | div |
className | string | |
colsHow many columns on wide screens. On phones it is two at most. | number | 2 |
gap | Gap | |
id | string | |
stackOn phones, one column instead of two. | boolean | |
style | CSSProperties |