Spacing
One 4 px grid for padding, gaps and sizes, seven corner radii and five breakpoints. The Figma Spacing, Radius and Layout variable collections hold the same numbers as the Tailwind classes the components are built with, so in a design is in code.
How to use
- Spacing is Tailwind v4's scale: is (4 px) and every step is a multiple of it. WunderUI's does not change it, so , , and are all 16 px.
- Lay out with the fifteen steps below. Tailwind also builds the steps in between (, …), but Figma has no variable for them, so stay on the scale wherever a layout comes from the Figma library.
- Radii are named, not numbered: for controls, for cards and dialogs. A surface should have a larger radius than the controls inside it.
- Change a radius once in an block and every component follows; see Theming.
// spacing/6 padding, spacing/4 gap, radius/xl corners: the Figma card, in classes
<div className="flex flex-col gap-4 rounded-xl border border-border bg-card p-6">
<h3 className="text-base font-semibold">Usage this month</h3>
<div className="flex gap-2">
<Button variant="plain" size="sm">Export</Button>
<Button size="sm">Upgrade</Button>
</div>
</div>Spacing scale
The fifteen variables of the Figma Spacing collection and the Tailwind step for each. Any spacing utility takes the step: , , , , , , , .
| Figma | Tailwind | px | Size |
|---|---|---|---|
| spacing/0 | p-0 | 0 | |
| spacing/0_5 | p-0.5 | 2 | |
| spacing/1 | p-1 | 4 | |
| spacing/1_5 | p-1.5 | 6 | |
| spacing/2 | p-2 | 8 | |
| spacing/3 | p-3 | 12 | |
| spacing/4 | p-4 | 16 | |
| spacing/5 | p-5 | 20 | |
| spacing/6 | p-6 | 24 | |
| spacing/8 | p-8 | 32 | |
| spacing/10 | p-10 | 40 | |
| spacing/12 | p-12 | 48 | |
| spacing/16 | p-16 | 64 | |
| spacing/20 | p-20 | 80 | |
| spacing/24 | p-24 | 96 |
Figma cannot put a dot in a variable name, so the half steps are and .
Radius
The Figma Radius collection. to are set in ; and are Tailwind's own and already match.
radius/none
rounded-none0radius/sm
rounded-sm4pxradius/md
rounded-md8pxradius/lg
rounded-lg12pxradius/xl
rounded-xl16pxradius/2xl
rounded-2xl24pxradius/full
rounded-full9999px| Class | CSS variable | Value | Used by |
|---|---|---|---|
| rounded-none | — | 0 | Inner buttons of a Button Group, the cells of a KPI Group |
| rounded-sm | --radius-sm | 4px | Skeleton text lines, focus outline of small inline controls |
| rounded-md | --radius-md | 8px | Button, Input, Badge, Tabs, sidebar rows, square Avatar, Toast |
| rounded-lg | --radius-lg | 12px | Popover, Dropdown Menu, Alert, Data Grid, KPI Group |
| rounded-xl | --radius-xl | 16px | Card, Dialog, Alert Dialog |
| rounded-2xl | --radius-2xl | 24px | KPI and Chart Card, Prompt Input, chat bubbles |
| rounded-full | — | calc(infinity * 1px) | Pill Button and Badge, Switch, round Avatar, status dots |
Two more steps exist only in code: (26.4px) and (31.2px). They are derived from (), have no Figma variable and no component uses them, so prefer the seven steps above.
Breakpoints
in the Figma Layout collection are Tailwind's default breakpoints, which WunderUI keeps. Classes are mobile first: applies from 768 px up.
| Figma | Prefix | Min width | CSS variable |
|---|---|---|---|
| breakpoint/sm | sm: | 640px · 40rem | --breakpoint-sm |
| breakpoint/md | md: | 768px · 48rem | --breakpoint-md |
| breakpoint/lg | lg: | 1024px · 64rem | --breakpoint-lg |
| breakpoint/xl | xl: | 1280px · 80rem | --breakpoint-xl |
| breakpoint/2xl | 2xl: | 1536px · 96rem | --breakpoint-2xl |
Containers & grid
The rest of the Layout collection describes the page frame designers draw on. These are Figma variables only; has no CSS variable for them, so build them from the classes in the right column.
| Figma | Value | In code |
|---|---|---|
| container/sm | 640px | max-w-[640px] |
| container/md | 768px | max-w-[768px] |
| container/lg | 1024px | max-w-[1024px] |
| container/xl | 1280px | max-w-[1280px] |
| container/2xl | 1400px | max-w-[1400px] |
| grid/columns | 12 | grid-cols-12 |
| grid/gutter | 24px | gap-6 |
| grid/margin | 24px | px-6 |
Tailwind's class caps the width at the current breakpoint, which makes it 1536 px at , not the 1400 px of . For the Figma frame, set the width yourself:
// container/2xl, grid/margin and grid/gutter: a 12-column page
<main className="mx-auto w-full max-w-[1400px] px-6">
<div className="grid grid-cols-4 gap-6 md:grid-cols-12">
<section className="col-span-4 md:col-span-8">…</section>
<aside className="col-span-4">…</aside>
</div>
</main>In plain CSS
Outside a class name, read the same values from the theme. is a Tailwind v4 function and works in any CSS file Tailwind processes; the radius steps are CSS variables.
.panel {
padding: --spacing(6); /* 24px */
gap: calc(var(--spacing) * 4); /* 16px, without the Tailwind function */
border-radius: var(--radius-xl); /* 16px */
}The components do the same. A sets its padding as (20 px), and switches it to (12 px), so header, content and footer stay aligned at either size.