UI.MD

Stack

A vertical flex container that spaces its children by rhythm rung, not an arbitrary gap value.

Installation

$
npx shadcn@latest add https://ui.mattdowney.com/r/stack.json

Usage

import { Stack } from "@/components/ui/stack"

Examples

Default

The rungs side by side. Pick one by the relationship between the blocks, not by the pixels you want: the numbers can be re-tuned later, the relationship stays.

bind (8px)

cluster (16px)

peer (24px)

region (48px)

section (96px)

PageHeader ramp

PageHeader's three sizes step the title, the description, and the gap below them together, so a header keeps the same rhythm whether it opens a page or a small section of one.

sm - title text-sm, description text-1xs, below 8px

Team settings

Manage members, roles, and permissions for this workspace.

md - title text-lg, description text-sm, below 16px

Team settings

Manage members, roles, and permissions for this workspace.

lg - title text-2xl, description text-base, below 24px

Team settings

Manage members, roles, and permissions for this workspace.

API Reference

PropTypeDefaultDescription
gap"bind" | "cluster" | "pair" | "trim-pair" | "lines" | "label" | "help" | "field" | "peer" | "region" | "section" | "heading-sm" | "heading-md" | "heading-lg""peer"Rung on the rhythm ladder: pair 4px, bind 8px, label 8px, help 8px, trim-pair 12px, lines 12px, cluster 16px, field 20px, heading-sm 20px, heading-md 24px, heading-lg 32px, peer 40px, region 60px, section 96px. The three heading-* rungs are the step below a heading and the content it introduces, the same tokens PageHeader applies under its own group, for when the heading and its content are siblings rather than parent and child (which is what PageTitleRow needs). Pick one by the heading beside it: a page h1 takes heading-lg, a section h2 heading-md. pair and trim-pair are the same relationship at two renderings: use trim-pair when the title carries cap-trim. It needs the bigger number twice over, once because the trim removes the half-leading a plain box supplies, and again because the trim measures the title's bottom edge at the baseline, so a descender paints into the gap.