Grid
24 column grid: Row, Col, spacing, adaptability and createBreakpoint.
When to use
Grid divides the line into 24 parts and sets the proportions of the page areas. Use Row and Col for forms, cards, and columns with a common grid. For free alignment of immediate children, Flex is suitable.
Place Col inside the Row, and place the contents or nested Row already in the column. This is a flexbox layout with regular div elements, not table semantics.
Rows, columns and spacing
span determines the column share: three Cols with span=8 occupy the entire line. If the amount is greater than 24, the next column is transferred entirely; wrap=false for Row disables wrapping. span=0 hides the column.
| Problem | Setting | Example |
|---|---|---|
| Split available width | Row, Col.span |
24 column grid |
| Expand columns and rows | gutter={[horizontal, vertical]} |
Horizontal and vertical gutter |
| Leave space in front of the column | offset |
Column offset |
| Adjust alignment | justify, align |
Vertical alignment |
| Combine shares and flexible width | Col.flex |
Flexible column width |
gutter accepts a number, CSS string or map of numeric values by breakpoint; the pair specifies intervals along two axes. Horizontal gutter uses negative Row padding and half column padding. Give the container room for them so that the grid doesn't create horizontal overflow on the page.
offset leaves beats in front of the column, push/pull shifts it, order changes the visual sequence. They do not change the reading order and Tab: for interactive elements, maintain a logical DOM order.
Responsiveness and theme
Xs/sm/md/lg/xl/xxl/xxxl accept a span or an object with span, offset, order, push, pull and flex. Narrower range values last until the next override. Adaptive number of columns and adaptive flex show these shapes.
Thresholds refer to the width of the viewport, not the card. Standard borders sm/md/lg/xl/xxl/xxxl - 576/768/992/1200/1600/1920 px. Row also accepts responsive align, justify and gutter.
The general theme.token.screen* controls the Row observation, and screen*min controls the Col media queries. When setting thresholds, agree on the minimum and maximum limits. Example of your thresholds uses a separate provider area; responsive CSS Col works without JavaScript.
There are no proprietary named Grid component design tokens. theme.components.Grid can refine common tokens and algorithms, as in example theme. Component overrides screen* by themselves do not change media queries Col. class/style and bind:nativeElement are available Row and Col; There are no separate classNames/styles or ConfigProvider.grid.
Row.prefixCls specifies the full local CSS row prefix, including wrap, align, justify, and RTL states. The empty string and undefined use ConfigProvider.prefixCls with the -row suffix. String prefixes show independent areas, responsive gutter and form field saving. Negative row margins and column padding continue to work together.
Row and Col resolve local prefixCls independently; empty string/undefined inherit the common prefix. Col renames the responsive classes and keeps the service namespace of the common provider without dots. FormItem takes into account the prefix and responsive geometry of the columns. theme.cssVar.prefix sets theme variables independent of row classes.
Screen monitoring
createBreakpoint - Svelte model with reactive screens and connected. Create it when you initialize the component; in onMount, connect breakpoint.connect(window) and return the resulting cleanup. Before connection, screens is empty, connected=false, so SSR does not require window.
The model uses the default breakpoints unless given explicit queries. The second argument to connect sets custom media queries. The breakpoint example uses Grid.useBreakpoint(). Call this hook during component initialization. It returns a reactive map based on the nearest theme and manages the browser subscriptions.
For a regular adaptive grid, props Row/Col are enough. Observation is needed when an application changes content or behavior to fit the screen size; read model fields reactively rather than keeping a one-time copy of screens.
Examples
24 column grid
Row contains Col. span specifies the fraction of 24; a sum greater than 24 moves the following columns to a new line.
<script lang="ts">
import { Row, Col } from '@woodger/antd';
</script>
<div class="rows">
<Row><Col span={24}><div class="cell">col-24</div></Col></Row>
<Row>
<Col span={12}><div class="cell">col-12</div></Col>
<Col span={12}><div class="cell alternate">col-12</div></Col>
</Row>
<Row>
<Col span={8}><div class="cell">col-8</div></Col>
<Col span={8}><div class="cell alternate">col-8</div></Col>
<Col span={8}><div class="cell">col-8</div></Col>
</Row>
<Row>
<Col span={6}><div class="cell">col-6</div></Col>
<Col span={6}><div class="cell alternate">col-6</div></Col>
<Col span={6}><div class="cell">col-6</div></Col>
<Col span={6}><div class="cell alternate">col-6</div></Col>
</Row>
</div>
<style>
.rows {
display: grid;
gap: 8px;
}
.cell {
min-width: 0;
padding: 16px 4px;
background: var(--ant-color-primary-bg);
color: var(--ant-color-text);
text-align: center;
}
.cell.alternate { background: var(--ant-color-primary-bg-hover); }
</style>
Horizontal and vertical gutter
A pair of values specifies the distance between columns and rows. A CSS string is valid for constant spacing, an object is valid for responsive numbers.
<script lang="ts">
import { Row, Col, Divider } from '@woodger/antd';
</script>
<Divider titlePlacement="start">{("Horizontal gutter")}</Divider>
<Row gutter={16}>
{#each [1, 2, 3, 4] as column (column)}<Col span={6}><div class="cell">col-6</div></Col>{/each}
</Row>
<Divider titlePlacement="start">{("Responsive gutter")}</Divider>
<Row gutter={{ xs: 8, sm: 16, md: 24, lg: 32 }}>
{#each [1, 2, 3, 4] as column (column)}<Col span={6}><div class="cell">col-6</div></Col>{/each}
</Row>
<Divider titlePlacement="start">{("Vertical gutter")}</Divider>
<Row gutter={[16, 24]}>
{#each [1, 2, 3, 4, 5, 6, 7, 8] as column (column)}<Col
span={6}
><div
class="cell"
>col-6</div></Col>{/each}
</Row>
<Divider titlePlacement="start">gutter="2rem"</Divider>
<Row gutter="2rem">
{#each [1, 2, 3, 4] as column (column)}<Col span={6}><div class="cell">col-6</div></Col>{/each}
</Row>
<style>
.cell {
min-width: 0;
padding: 8px 0;
background: var(--ant-color-primary-bg);
color: var(--ant-color-text);
text-align: center;
overflow-wrap: anywhere;
}
</style>
Column offset
offset adds empty beats before the column. The content remains in the same DOM order.
<script lang="ts">
import { Row, Col } from '@woodger/antd';
</script>
<div class="rows">
<Row>
<Col span={8}><div class="cell">col-8</div></Col>
<Col span={8} offset={8}><div class="cell alternate">col-8</div></Col>
</Row>
<Row>
<Col span={6} offset={6}><div class="cell">col-6 col-offset-6</div></Col>
<Col span={6} offset={6}><div class="cell alternate">col-6 col-offset-6</div></Col>
</Row>
<Row><Col span={12} offset={6}><div class="cell">col-12 col-offset-6</div></Col></Row>
</div>
<style>
.rows {
display: grid;
gap: 8px;
}
.cell {
min-width: 0;
padding: 16px 4px;
background: var(--ant-color-primary-bg);
color: var(--ant-color-text);
text-align: center;
overflow-wrap: anywhere;
}
.cell.alternate { background: var(--ant-color-primary-bg-hover); }
</style>
Push and pull movement
push/pull visually shifts the columns. They do not change the reading order and Tab order.
<script lang="ts">
import { Row, Col } from '@woodger/antd';
</script>
<style>
.cell.alternate { background: var(--ant-color-primary-bg-hover); }
.cell {
min-width: 0;
padding: 16px 4px;
background: var(--ant-color-primary-bg);
color: var(--ant-color-text);
text-align: center;
overflow-wrap: anywhere;
}
</style>
<Row>
<Col span={18} push={6}><div class="cell">col-18 col-push-6</div></Col>
<Col span={6} pull={18}><div class="cell alternate">col-6 col-pull-18</div></Col>
</Row>
Horizontal distribution
justify sets the position of the columns and free space within the Row.
<script lang="ts">
import { Row, Col, type RowJustify } from '@woodger/antd';
let justify = $state<RowJustify>('center');
</script>
<style>
.cell.alternate { background: var(--ant-color-primary-bg-hover); }
.cell {
min-width: 0;
padding: 16px 4px;
background: var(--ant-color-primary-bg);
color: var(--ant-color-text);
text-align: center;
overflow-wrap: anywhere;
}
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
label {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
</style>
<div
class="controls"
>
<label>{("Distribution ")}<select
bind:value={justify}
>
<option
value="start"
>
{("At the beginning")}
</option>
<option value="center">
{("In the center")}
</option>
<option value="end">
{("At the end")}
</option>
<option value="space-between">
{("Between")}
</option>
<option value="space-around">
{("Around")}
</option>
<option value="space-evenly">
{("Evenly")}
</option>
</select></label>
</div>
<Row {justify} style="background:var(--ant-color-fill-quaternary)">
{#each [1, 2, 3, 4] as number (number)}<Col span={4}><div class="cell" class:alternate={number
% 2 === 0}>col-4</div></Col>{/each}
</Row>
Vertical alignment
align aligns columns of different heights to the top, middle or bottom.
<script lang="ts">
import { Row, Col, type RowAlign } from '@woodger/antd';
let align = $state<RowAlign>('middle');
</script>
<style>
.cell.alternate { background: var(--ant-color-primary-bg-hover); }
.cell {
min-width: 0;
padding: 16px 4px;
background: var(--ant-color-primary-bg);
color: var(--ant-color-text);
text-align: center;
overflow-wrap: anywhere;
}
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
label {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
</style>
<div
class="controls"
>
<label>{("Column alignment ")}<select
bind:value={align}
>
<option
value="top"
>
{("Top")}
</option>
<option value="middle">
{("In the middle")}
</option>
<option value="bottom">
{("Bottom")}
</option>
</select></label>
</div>
<Row
{align}
justify="space-around"
style="
min-height: 150px;
background: var(--ant-color-fill-quaternary);
"
>
{#each [55, 85, 115] as height, index (height)}<Col
span={6}
><div
class="cell"
class:alternate={index % 2 === 1}
style={`height:${height}px`}
>{(height)}</div></Col>{/each}
</Row>
Column order
order changes the visual order while preserving the DOM. Use this with accessibility and keyboard considerations in mind.
<script lang="ts">
import { Row, Col } from '@woodger/antd';
let reversed = $state(false);
</script>
<style>
.cell.alternate { background: var(--ant-color-primary-bg-hover); }
.cell {
min-width: 0;
padding: 16px 4px;
background: var(--ant-color-primary-bg);
color: var(--ant-color-text);
text-align: center;
overflow-wrap: anywhere;
}
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
label {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
</style>
<div class="controls">
<label><input type="checkbox" bind:checked={reversed} />{(" Reverse order")}</label>
</div>
<Row gutter={8}>
{#each [1, 2, 3] as number (number)}
<Col span={8} order={reversed ? 4 - number : number}><div class="cell" class:alternate={number
% 2 === 0}>{("Item ")}{(number)}</div></Col>
{/each}
</Row>
Flexible column width
flex supports weight, fixed length and auto. wrap=false leaves one line.
<script lang="ts">
import { Row, Col } from '@woodger/antd';
</script>
<style>
.cell.alternate { background: var(--ant-color-primary-bg-hover); }
.cell {
min-width: 0;
padding: 16px 4px;
background: var(--ant-color-primary-bg);
color: var(--ant-color-text);
text-align: center;
overflow-wrap: anywhere;
}
</style>
<Row wrap={false} gutter={8}>
<Col
flex="100px"
><div
class="cell"
>100px</div></Col><Col
flex="auto"
><div
class="cell alternate"
>auto</div></Col>
</Row>
<Row gutter={8} style="margin-top:16px">
<Col
flex={1}
><div
class="cell"
>1</div></Col><Col
flex={2}
><div
class="cell alternate"
>2</div></Col>
</Row>
Adaptive number of columns
xs/sm/md/lg depend on the viewport, not the width of the card. Change the window width to compare layout.
<script lang="ts">
import { Row, Col } from '@woodger/antd';
</script>
<style>
.cell.alternate { background: var(--ant-color-primary-bg-hover); }
.cell {
min-width: 0;
padding: 16px 4px;
background: var(--ant-color-primary-bg);
color: var(--ant-color-text);
text-align: center;
overflow-wrap: anywhere;
}
</style>
<Row gutter={[16, 16]}>
{#each [1, 2, 3, 4] as number (number)}
<Col
xs={24}
sm={12}
md={8}
lg={6}
><div
class="cell"
class:alternate={number % 2 === 0}
>{("Column ")}{(number)}</div></Col>
{/each}
</Row>
Adaptive flex
Breakpoint objects can specify flex instead of span. Dimensions are changed via CSS variables Col.
<script lang="ts">
import { Row, Col } from '@woodger/antd';
</script>
<style>
.cell.alternate { background: var(--ant-color-primary-bg-hover); }
.cell {
min-width: 0;
padding: 16px 4px;
background: var(--ant-color-primary-bg);
color: var(--ant-color-text);
text-align: center;
overflow-wrap: anywhere;
}
</style>
<Row>
{#each [1, 2, 3, 4] as number (number)}
<Col xs={{ flex: '100%' }} sm={{ flex: '50%' }} lg={{ flex: '25%' }}>
<div class="cell" class:alternate={number % 2 === 0}>{("Block ")}{(number)}</div>
</Col>
{/each}
</Row>
Parameters at different breakpoints
In a breakpoint object you can combine span, offset and order. gutter, align and justify Row also accept a responsive map.
<script lang="ts">
import { Row, Col } from '@woodger/antd';
</script>
<style>
.cell.alternate { background: var(--ant-color-primary-bg-hover); }
.cell {
min-width: 0;
padding: 16px 4px;
background: var(--ant-color-primary-bg);
color: var(--ant-color-text);
text-align: center;
overflow-wrap: anywhere;
}
</style>
<Row gutter={[{ xs: 8, sm: 16, md: 24 }, 12]} align={{ xs: 'top', md: 'middle' }} justify={{
xs: 'start',
md: 'center'
}}>
<Col
xs={{ span: 24, order: 2, offset: 0 }}
md={{ span: 8, order: 1, offset: 4 }}
><div
class="cell"
>{("Main unit")}</div></Col>
<Col xs={{ span: 24, order: 1 }} md={{ span: 12, order: 2 }}>
<div class="cell alternate">
{("Addition")}
</div>
</Col>
</Row>
Custom Grid
Change the number of columns and both spacing. The application calculates the span from the selected quantity.
<script lang="ts">
import { Row, Col } from '@woodger/antd';
let columns = $state(4);
let horizontal = $state(16);
let vertical = $state(16);
</script>
<style>
.cell.alternate { background: var(--ant-color-primary-bg-hover); }
.cell {
min-width: 0;
padding: 16px 4px;
background: var(--ant-color-primary-bg);
color: var(--ant-color-text);
text-align: center;
overflow-wrap: anywhere;
}
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
label {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
</style>
<div class="controls">
<label>{("Speakers ")}<select
bind:value={columns}
>{#each [2, 3, 4, 6] as count (count)}<option
value={count}
>{(count)}</option>{/each}</select></label>
<label>{("Horizontal spacing ")}<input
type="range"
min="0"
max="32"
step="8"
bind:value={horizontal}
/><output>{horizontal}</output></label>
<label>{("Vertical spacing ")}<input
type="range"
min="0"
max="32"
step="8"
bind:value={vertical}
/><output>{vertical}</output></label>
</div>
<Row gutter={[horizontal, vertical]} role="group" aria-label={("Custom Grid")}>
{#each Array.from({ length: columns * 2 }, (_, index) => index + 1) as number (number)}
<Col span={24 / columns}>
<div class="cell" class:alternate={number % 2 === 0}>{("Column ")}{(number)}</div>
</Col>
{/each}
</Row>
Matched media queries:
Starting from sm, several thresholds can coincide simultaneously.
Monitoring breakpoint
Grid.useBreakpoint() returns a reactive breakpoint map. Subscriptions follow the component lifecycle.
<script lang="ts">
import { Grid } from '@woodger/antd';
const screens = Grid.useBreakpoint();
const active = $derived(Object.entries(screens)
.filter(([, matches]) => matches).map(([name]) => name).join(', '));
</script>
<p>{("Matched media queries:")}</p>
<output aria-label={("Active Grid breakpoints")}>{Object.keys(screens).length
? active
: ("After connecting the browser")}</output>
<p>{("Starting from sm, several thresholds can coincide simultaneously.")}</p>
Mesh direction
Columns follow the direction of the provider. Logical intervals do not require separate styles for RTL.
<script lang="ts">
import { ConfigProvider, Row, Col } from '@woodger/antd';
let rtl = $state(false);
</script>
<style>
.cell.alternate { background: var(--ant-color-primary-bg-hover); }
.cell {
min-width: 0;
padding: 16px 4px;
background: var(--ant-color-primary-bg);
color: var(--ant-color-text);
text-align: center;
overflow-wrap: anywhere;
}
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
label {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
</style>
<div class="controls">
<label><input type="checkbox" bind:checked={rtl} />{(" Grid from right to left")}</label>
</div>
<ConfigProvider direction={rtl ? 'rtl' : 'ltr'}>
<Row
gutter={8}
><Col
span={8}
><div
class="cell"
>{("First")}</div></Col><Col
span={16}
><div
class="cell alternate"
>{("Second")}</div></Col></Row>
</ConfigProvider>
Component Grid theme
theme.components.Grid specifies Row and Col alias tokens; the nested theme and local style have their own precedence.
<script lang="ts">
import { Checkbox, Col, ConfigProvider, Input, Row } from '@woodger/antd';
let enabled = $state(true);
let draft = $state(("Saved when changing theme"));
</script>
<style>
.settings { margin-bottom: 24px; }
.example { padding-inline: 8px; }
.nested { margin-top: 24px; }
</style>
<div
class="settings"
><Checkbox
bind:checked={enabled}
>{("Apply Grid theme")}</Checkbox></div>
<ConfigProvider theme={{
components: { Grid: enabled ? { fontSize: 18, fontFamily: 'serif' } : {} }
}}>
<div class="example">
<Row gutter={16} class="grid-themed-row">
<Col span={12} class="grid-themed-col">{("Theme Row and Col")}</Col>
<Col span={12} style="font-size:16px" class="grid-local-col">
{("Local size 16px")}
</Col>
</Row>
<div class="nested">
<ConfigProvider theme={{ components: { Grid: { fontSize: 12, fontFamily: 'monospace' } } }}>
<Row
class="grid-nested-row"
><Col
span={24}
>{("Nested theme 12px")}</Col></Row>
</ConfigProvider>
</div>
</div>
<Input
aria-label={("Draft Grid theme")}
bind:value={draft}
style="margin-top:24px"
/>
</ConfigProvider>
General md: 900px. Below the threshold there is one column, above it there are two.
Isolated provider: standard md from 768px.
Thresholds from the general topic
screenMD changes observer Row, screenMDMin - media queries Col, including SSR without JavaScript. For comparison, an isolated standard mesh is nearby.
<script lang="ts">
import { Checkbox, Col, ConfigProvider, Input, Row } from '@woodger/antd';
let raised = $state(true);
let draft = $state(("Data saved"));
const md = $derived(raised ? 900 : 768);
</script>
<style>
.settings { margin-bottom: 24px; }
.example { padding-inline: 16px; }
.label { margin: 0 0 12px; }
.nested { margin-top: 24px; }
.cell {
padding: 12px;
border-radius: 4px;
background: var(--ant-color-fill-secondary);
}
</style>
<div
class="settings"
><Checkbox
bind:checked={raised}
>{("Threshold md from 900px")}</Checkbox></div>
<ConfigProvider theme={{ token: { screenSMMax: md - 1, screenMD: md, screenMDMin: md } }}>
<div class="example">
<p class="label">{("General md: ")}{md}{("px. Below the threshold there is one column, above it there are two.")}</p>
<Row gutter={{ xs: 8, sm: 12, md: 32 }} class="grid-custom-breakpoints">
<Col xs={24} md={12}><div class="cell">{("First column")}</div></Col>
<Col xs={24} md={12}><div class="cell">{("Second column")}</div></Col>
</Row>
<div class="nested">
<ConfigProvider theme={{ inherit: false }}>
<p class="label">{("Isolated provider: standard md from 768px.")}</p>
<Row gutter={{ xs: 8, sm: 12, md: 32 }} class="grid-default-breakpoints">
<Col xs={24} md={12}><div class="cell">{("Standard first")}</div></Col>
<Col xs={24} md={12}><div class="cell">{("Standard second")}</div></Col>
</Row>
</ConfigProvider>
</div>
</div>
<Input
aria-label={("Draft Grid Thresholds")}
bind:value={draft}
style="margin-top:24px"
/>
</ConfigProvider>
Both lines use the same local class. Row and Col choose local prefixes independently; the empty line selects a generic namespace. Col service variables use a common prefix without dots, separate from the topic. The field and form data are saved.
Grid Row Prefixes
Local and global prefixCls Row, adaptive spacing and RTL. Col keeps its own classes; the draft and form data remain in place.
<script lang="ts">
import { Button, Checkbox, Col, ConfigProvider, Input, Row } from '@woodger/antd';
let custom = $state(true);
let local = $state(true);
let rtl = $state(false);
let localCol = $state(true);
let draft = $state('');
let saved = $state('');
const prefix = $derived(custom ? 'suite' : 'ant');
</script>
<style>
.example, form {
display: grid;
gap: 20px;
min-width: 0;
}
.controls {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.surface {
min-width: 0;
padding-inline: 12px;
}
.tile {
display: grid;
box-sizing: border-box;
gap: 8px;
min-width: 0;
padding: 12px;
border-radius: 8px;
background: var(--ant-color-fill-secondary);
overflow-wrap: anywhere;
}
p { margin: 0; }
output { overflow-wrap: anywhere; }
</style>
<div class="example">
<div class="controls">
<Checkbox bind:checked={custom}>{("General prefix Row suite")}</Checkbox>
<Checkbox bind:checked={local}>{("Local prefix Row")}</Checkbox>
<Checkbox bind:checked={localCol}>{("Local prefix Col")}</Checkbox>
<Checkbox bind:checked={rtl}>{("RTL Row with prefix")}</Checkbox>
</div>
<form aria-label={("Draft mesh with prefix")} onsubmit={event => {
event.preventDefault();
saved = String(new FormData(event.currentTarget).get('draft') ?? '');
}}>
<ConfigProvider prefixCls={prefix} direction={rtl ? 'rtl' : 'ltr'}
theme={{ cssVar: { prefix: 'row-theme' } }}>
<div class="surface">
<Row prefixCls={local ? 'project-row' : ''} class="prefix-row-main"
gutter={[{ xs: 8, md: 24 }, 12]} align={{ xs: 'top', md: 'middle' }}
justify={{ xs: 'start', md: 'space-between' }}>
<Col prefixCls={localCol ? 'project-col' : ''} xs={24} md={12}>
<div class="tile">
<span>{("Draft")}</span>
<Input name="draft" bind:value={draft} aria-label={("Draft Row with prefix")}
style="width:100%" />
</div>
</Col>
<Col prefixCls={localCol ? 'project-col' : ''} xs={24} md={8}>
<div class="tile">
{("Adaptive column")}
</div>
</Col>
</Row>
</div>
</ConfigProvider>
<div><Button htmlType="submit">{("Send draft mesh")}</Button></div>
</form>
<ConfigProvider prefixCls="neighbor">
<div class="surface">
<Row prefixCls={local ? 'project-row' : ''} class="prefix-row-neighbor"
gutter={[8, 8]} align="middle" justify="center" wrap={false}>
<Col prefixCls={localCol ? 'project-col' : ''} flex={1}>
<div class="tile">
{("Next line")}
</div>
</Col>
<Col prefixCls={localCol ? 'project-col' : ''} flex={1}>
<div class="tile">
{("Without transfer")}
</div>
</Col>
</Row>
</div>
</ConfigProvider>
<output
aria-label={("Prefix Row")}
>{("\n General: ")}{prefix}{("; class: ")}{(local ? 'project-row' : prefix + '-row')}
</output>
<output aria-label={("Submitted draft Row")}>{(saved || '—')}</output>
<p>
{("Both lines use the same local class. Row and Col choose local prefixes independently; the empty line selects a generic namespace. Col service variables use a common prefix without dots, separate from the topic. The field and form data are saved.")}
</p>
</div>
Project cards
Saved adaptive viewing grid with variable horizontal gutter.
<script lang="ts">
import { Row, Col } from '@woodger/antd';
let gutter = $state(16);
</script>
<label>{("Column spacing ")}<input
type="range"
min="0"
max="48"
step="8"
bind:value={gutter}
/></label>
<Row gutter={[gutter, 16]}>
{#each ["Planning", "Development", "Check", "Issue"] as title}
<Col xs={24} sm={12} lg={6}><div class="grid-cell">{(title)}</div></Col>
{/each}
</Row>
<style>
label {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 16px;
}
.grid-cell {
padding: 16px;
background: var(--ant-color-primary-bg);
color: var(--ant-color-text);
border-radius: var(--ant-border-radius);
}
</style>
API
Themes of the ant.design live page are mapped to the public API of the installed package. Full definitions of Props are in @woodger/antd.
| Theme | Example or limitation |
|---|---|
| Basic Grid | 24 shares. |
| Grid Gutter | Horizontal and vertical spacing. |
| Column offset | Empty shares. |
| Grid sort | push/pull. |
| Typesetting | Distribution of free space. |
| Alignment | Different column heights. |
| Order | Visual order. |
| Flex Stretch | Weight, fixed length and auto. |
| Responsive | Number of columns by viewport. |
| Flex Responsive | flex in responsive object. |
| More responsive | span/offset/order and responsive Row. |
| Playground | Number of columns and two spaces. |
| useBreakpoint Hook | Grid.useBreakpoint() uses the breakpoints of the nearest theme. |
| Row CSS prefix | String prefixes, responsive gutter, RTL and form field saving; Col is connected separately. |
| Property | Description | Type | Default |
|---|---|---|---|
prefixCls | Full local prefix Row. The empty string and undefined inherit the provider prefix. Col chooses its prefix independently. | string | ConfigProvider. |
gutter | Number in px, CSS string or responsive map of numbers; the pair specifies the horizontal and vertical spacing. | GridGutter | [GridGutter, GridGutter] | 0 |
align | top/middle/bottom/stretch, including breakpoint. | RowAlign | GridResponsive | CSS stretch |
justify | start/end/center/space-around/space-between/space-evenly. | RowJustify | GridResponsive | start |
wrap | Permission to move columns. | boolean | true |
children | Direct Col inside Row. | Snippet | — |
class | Root row class. | string | — |
style | Inline CSS of the root line. | string | — |
nativeElement | bind:nativeElement for Row and Col. | HTMLDivElement | — |
Col
span - width from 0 to 24, 0 hides the column. offset adds beats before it; order specifies the CSS order; push/pull are shifted relative to the original position. flex accepts a number, length, auto, or CSS flex string.
xs, sm, md, lg, xl, xxl and optional xxxl accept a span or ColSize object: span, order, offset, push, pull and flex. For string span, it is safer to pass a number: responsive shorthand works with number.
Thresholds viewport
xs: up to 575px; sm: from 576px; md: from 768px; lg: from 992px; xl: from 1200px; xxl: from 1600px; xxxl: from 1920px. Values sm and higher are in effect until the next override.
Semantic DOM
Row and Col create divs without any additional wrappers. Inside the Row, place a Col, and inside the Col, the contents or nested Row. CSS grid systems are based on flexbox; The table role is not assigned to these containers.
Row and Col support class/style and bind:nativeElement. Dedicated classNames/styles and ConfigProvider.grid are unavailable. Grid.useBreakpoint() observes the viewport. Use createBreakpoint to manage the connection manually.
Row.prefixCls changes the root and states of wrap, align, justify and RTL. The Col classes and its service namespace remain ant-col: the local or general Row prefix does not rename them. theme.cssVar.prefix separately specifies the namespace of theme variables.
Registration tokens
Grid does not have its own component tokens. theme.components.Grid accepts alias tokens and algorithms: for example, fontSize and fontFamily are applied to Row and Col, including with SSR. Local style takes precedence.
Thresholds are set through common theme.token: screenMD and other screen* control responsive observer Row, and screenMDMin and other screen*min control media queries Col. Change the agreed boundaries together, respecting screen*min ≤ screen* ≤ screen*max ≤ next screen*min. Col uses the provider's own CSS scope and works without JavaScript. Component overrides Grid.screen* do not change media queries.
A separate createBreakpoint() model without explicit queries uses standard thresholds. For your queries, pass them as the second argument to breakpoint.connect(window, mediaQueries). The model does not read the topic automatically.
| Token | Current value |
|---|---|
screenXS | 480 |
screenXSMin | 480 |
screenXSMax | 575 |
screenSM | 576 |
screenSMMin | 576 |
screenSMMax | 767 |
screenMD | 768 |
screenMDMin | 768 |
screenMDMax | 991 |
screenLG | 992 |
screenLGMin | 992 |
screenLGMax | 1199 |
screenXL | 1200 |
screenXLMin | 1200 |
screenXLMax | 1599 |
screenXXL | 1600 |
screenXXLMin | 1600 |
FAQ
Why does Row extend beyond the edges of the content?
Horizontal gutter creates negative padding. Match them with the padding and width of the outer container.
Why doesn't responsiveness follow the width of the card?
Breakpoints use viewport. Dependency on container width requires a separate application solution.
Is it possible to change the order of fields using order?
The visual order will change, but Read and Tab will maintain the DOM sequence. Keep this in mind when laying out your form.
How to connect createBreakpoint with SSR?
Create a model in script, connect it to onMount and return cleanup. Until mount, the screens card remains empty.