Manage spacing with Stack and Row
Give vertical and horizontal groups one spacing owner. Use Col for flexible children, a responsive gap for changing density, and render for meaningful HTML.
Install Stack, Row, and Col
Use a React 19 and TypeScript project with Tailwind CSS 4 and shadcn/ui configured. After registering @layout-kit, add just these three primitives; the CLI resolves their shared spacing source and Base UI dependency.
npx shadcn@latest add @layout-kit/stack @layout-kit/row @layout-kit/colStart with registry installation if the namespace is not configured. The example uses plain text and requires no additional shadcn components or event handlers.
Let the parent own spacing
Stack is a vertical flex container; Row is a horizontal flex container. Both own gap, align, and justify. Put spacing on the container instead of giving each child a bottom or right margin.
Complete project list
The outer gap increases from 4 to 6 at md. Individual rows can wrap, and a flex basis gives the description room before the status moves to the next line.
Projects
Two sample projects
- In progress
Storefront
Product pages and checkout
- Ready for review
Documentation
Examples and API reference
import { Col } from "@/components/ui/col";
import { Row } from "@/components/ui/row";
import { Stack } from "@/components/ui/stack";
const projects = [
{ name: "Storefront", detail: "Product pages and checkout", status: "In progress" },
{ name: "Documentation", detail: "Examples and API reference", status: "Ready for review" },
];
export function ProjectList() {
return (
<Stack gap={{ base: 4, md: 6 }}>
<Row justify="between" gap={3} wrap>
<h2 className="text-lg font-semibold">Projects</h2>
<p className="text-sm text-muted-foreground">Two sample projects</p>
</Row>
<Stack render={<ul />} gap={3}>
{projects.map((project) => (
<Row key={project.name} render={<li />} gap={3} align="start" wrap>
<Col grow className="basis-48">
<Stack gap={1}>
<h3 className="font-medium">{project.name}</h3>
<p className="text-sm text-muted-foreground">{project.detail}</p>
</Stack>
</Col>
<span className="text-sm text-muted-foreground">{project.status}</span>
</Row>
))}
</Stack>
</Stack>
);
}Wrapping and semantics
Use direct Tailwind classes for an isolated layout or a value outside the supported scale. Layout Kit is useful when repeated arrangements benefit from shared typed props. See Stack, Row, and Col for the complete API.