Skip to main content
  1. Docs
  2. Foundations
  3. 03 of 05

Spacing

Space on a 4px grid, near-square corners and three densities.

Grid
4pxEvery space a multiple
Space steps
9From 4px to 64px
Densities
3Compact to comfortable
Size classes
5Compact to extra large
Density
Every bar and value below follows it

01

Space

Every padding and gap is a step on the 4px grid; each cell of a bar is 4px.

All 19 spaces and sizes sit on the 4px grid, at every density

insetPadding inside a container
0.25rem · 4px
0.5rem · 8px
0.75rem · 12px
1rem · 16px
1.5rem · 24px
gapBetween siblings in a stack or row
0.25rem · 4px
0.5rem · 8px
0.75rem · 12px
1rem · 16px
1.5rem · 24px
layoutBetween page regions
1.5rem · 24px
2rem · 32px
3rem · 48px
4rem · 64px
formBetween form fields, by density
0.75rem · 12px1rem · 16px1.25rem · 20px

02

Scale

One 4px scale under every name: each step, and the tokens that use it at default density.

The space scale and the tokens on each step
StepValueTo scaleTokens
1000.25rem · 4px
2000.5rem · 8px
3000.75rem · 12px
4001rem · 16px
5001.25rem · 20px—
6001.5rem · 24px
8002rem · 32px
12003rem · 48px
16004rem · 64px

03

In use

A form as it ships, its space drawn as redlines. Switch the density above and the gaps follow.

  1. 1Padding inside the card · 1rem · 16px
  2. 2Between the fields · 0.75rem · 12px1rem · 16px1.25rem · 20px
  3. 3Between the buttons · 0.5rem · 8px

04

Radius

Four corner values, shared by role and drawn at 4×. Only people, choices and tags read round.

0px
2px
  • Small marks that stay square: a checkbox, a switch track, a keyboard key.
4px
  • Buttons, fields, selects: every control. Fields round only their top corners.
  • Cards, panels and other containers.
  • Menus, popovers and other floating surfaces.
  • Dialogs and drawers.
9999px
  • Status tags: full pills.
  • People and choices that must read round: avatars, radios, presence dots.

05

Control sizes

Real controls at each height. Heights and values follow the Density toolbar.

ControlsFields are always lg
1.5rem · 24px1.75rem · 28px2rem · 32px
1.75rem · 28px2rem · 32px2.25rem · 36px
2rem · 32px2.5rem · 40px2.75rem · 44px
Rows and targets
2rem · 32px2.5rem · 40px3rem · 48px
NameRole
Priya SharmaOwner
Rahul VermaAdmin
24px · WCAG 2.5.8
The smallest pointer target any control may have

06

Density

The same form at each density; each panel pins data-qx-density.

compact
Profile
NameRole
Priya SharmaOwner
Rahul VermaAdmin
default
Profile
NameRole
Priya SharmaOwner
Rahul VermaAdmin
comfortable
Profile
NameRole
Priya SharmaOwner
Rahul VermaAdmin
What each density sets
The tokens each density sets
Tokencompactdefaultcomfortable
--qx-size-control-sm1.5rem · 24px1.75rem · 28px2rem · 32px
--qx-size-control-md1.75rem · 28px2rem · 32px2.25rem · 36px
--qx-size-control-lg2rem · 32px2.5rem · 40px2.75rem · 44px
--qx-size-row2rem · 32px2.5rem · 40px3rem · 48px
--qx-space-form-gap0.75rem · 12px1rem · 16px1.25rem · 20px

07

Breakpoints

Window size classes, to scale. The marker shows this window's width.

  1. compact0–599px
  2. medium600–839px
  3. expanded840–1199px
  4. large1200–1599px
  5. xlarge1600px and up
In code
Window size classes in CSS and JavaScript
ClassCSSJavaScriptGrid key
compact——base
medium@media (--qx-viewport-medium)BREAKPOINT.mediummedium
expanded@media (--qx-viewport-expanded)BREAKPOINT.expandedexpanded
large@media (--qx-viewport-large)BREAKPOINT.largelarge
xlarge@media (--qx-viewport-xlarge)BREAKPOINT.xlargexlarge

08

Component sizes

Fixed geometry for a few components, drawn to scale and exported as COMPONENT.

Command palette
36rem · 576pxCOMPONENT.commandPalette.width
Sidebar
3rem · 48pxCOMPONENT.sidebar.width.collapsed
16rem · 256pxCOMPONENT.sidebar.width.expanded
18rem · 288pxCOMPONENT.sidebar.width.mobile
Timeline
28pxCOMPONENT.timeline.markerSize
Tour
18rem · 288pxCOMPONENT.tour.cardWidth
12pxCOMPONENT.tour.offset
6pxCOMPONENT.tour.spotlightPadding

09

In code

Space is a token, never a number. A density set on a container reaches everything inside it.

invite.css
.invite-card {
  padding: var(--qx-space-inset-lg);
  display: grid;
  gap: var(--qx-space-form-gap);
}

.invite-actions {
  display: flex;
  gap: var(--qx-space-gap-sm);
}
invite.tsx
import { Button, Stack, TextField } from "@qeetrix/react";

export function Invite() {
  return (
    <div data-qx-density="compact">
      <Stack gap="lg">
        <TextField label="Work email" />
        <TextField label="Display name" />
      </Stack>
      <Button>Invite</Button>
    </div>
  );
}
Next — 04 of 05Elevation