Skip to content
Foundations

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.
tsx
// 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: , , , , , , , .

FigmaTailwindpxSize
spacing/0p-00
spacing/0_5p-0.52
spacing/1p-14
spacing/1_5p-1.56
spacing/2p-28
spacing/3p-312
spacing/4p-416
spacing/5p-520
spacing/6p-624
spacing/8p-832
spacing/10p-1040
spacing/12p-1248
spacing/16p-1664
spacing/20p-2080
spacing/24p-2496

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-none0

radius/sm

rounded-sm4px

radius/md

rounded-md8px

radius/lg

rounded-lg12px

radius/xl

rounded-xl16px

radius/2xl

rounded-2xl24px

radius/full

rounded-full9999px
ClassCSS variableValueUsed by
rounded-none—0Inner buttons of a Button Group, the cells of a KPI Group
rounded-sm--radius-sm4pxSkeleton text lines, focus outline of small inline controls
rounded-md--radius-md8pxButton, Input, Badge, Tabs, sidebar rows, square Avatar, Toast
rounded-lg--radius-lg12pxPopover, Dropdown Menu, Alert, Data Grid, KPI Group
rounded-xl--radius-xl16pxCard, Dialog, Alert Dialog
rounded-2xl--radius-2xl24pxKPI 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.

FigmaPrefixMin widthCSS variable
breakpoint/smsm:640px · 40rem--breakpoint-sm
breakpoint/mdmd:768px · 48rem--breakpoint-md
breakpoint/lglg:1024px · 64rem--breakpoint-lg
breakpoint/xlxl:1280px · 80rem--breakpoint-xl
breakpoint/2xl2xl: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.

FigmaValueIn code
container/sm640pxmax-w-[640px]
container/md768pxmax-w-[768px]
container/lg1024pxmax-w-[1024px]
container/xl1280pxmax-w-[1280px]
container/2xl1400pxmax-w-[1400px]
grid/columns12grid-cols-12
grid/gutter24pxgap-6
grid/margin24pxpx-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:

tsx
// 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.

css
.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.