Skip to content

Spacing and radius ​

Ooko uses shared spacing and corner-radius tokens to keep component density and shape consistent. Bounded token values use rem so they continue to follow the consumer's root font size.

Spacing primitives ​

The spacing scale is based on a 0.25rem step, with half steps for compact control layouts. Use these tokens for padding, margin, gap, border spacing, and scroll spacing.

TokenValueSize at a 16px root
--o-space-000px
--o-space-0-50.125rem2px
--o-space-10.25rem4px
--o-space-1-50.375rem6px
--o-space-20.5rem8px
--o-space-2-50.625rem10px
--o-space-30.75rem12px
--o-space-41rem16px
--o-space-51.25rem20px
--o-space-61.5rem24px
--o-space-82rem32px
--o-space-102.5rem40px
--o-space-123rem48px
--o-space-164rem64px

Components expose meaningful custom properties such as --o-button-padding and map their defaults to this primitive scale. Prefer the component property when customizing one component, and a spacing primitive when authoring a new component or layout.

css
.example-layout {
  display: grid;
  gap: var(--o-space-4);
  padding: var(--o-space-6);
}

Direct spacing values are reserved for browser resets or a documented optical or technical constraint that the scale cannot express. Dimensions, border widths, typography, and icon sizes are not spacing and do not use this scale.

Form-control sizes ​

Form-related components accept only sm and md, with md as their built-in default.

SizeTokenDefault
sm--o-control-form-height-sm1.75rem
md--o-control-form-height-md2.25rem

Controls are compact (36px by default) while surfaces stay airy: cards pad their content by 1.25rem and separate sections by 1rem, and table cells use 0.75rem by 1rem. The contrast between dense controls and generous layout is what keeps an admin screen readable.

These minimum heights preserve text wrapping and user font-size growth rather than forcing a fixed block size.

Radius primitives ​

TokenValueSize at a 16px root
--o-radius-none00px
--o-radius-xs0.125rem2px
--o-radius-sm0.25rem4px
--o-radius-md0.375rem6px
--o-radius-lg0.5rem8px
--o-radius-xl0.75rem12px
--o-radius-2xl1rem16px
--o-radius-full9999pxFully rounded

Semantic radius roles ​

Components consume semantic roles so Ooko's overall shape can be adjusted without overriding each component independently.

TokenDefaultIntended use
--o-radius-control-compactvar(--o-radius-sm)Small controls and close actions
--o-radius-controlvar(--o-radius-lg)Form controls
--o-radius-surfacevar(--o-radius-xl)Alerts, cards, and containers
--o-radius-overlayvar(--o-radius-2xl)Dialogs, menus, and popovers
--o-radius-roundvar(--o-radius-full)Buttons, segmented controls, pagination, and chips

Override a semantic role in an unlayered stylesheet loaded after Ooko to change every consumer of that role:

css
:root {
  --o-radius-control: var(--o-radius-lg);
  --o-radius-surface: var(--o-radius-xl);
}

Use a component custom property for a local exception. Avoid applying primitive radius tokens directly inside components when an existing semantic role describes the element.