Skip to main content

Spacing

A consistent spacing scale based on 4px increments for margins, padding, and gaps.

Spacing Scale

TokenValueTypical Use
xxsmall4pxInline icon gaps, tight element spacing
xsmall8pxRelated element spacing, small padding
small12pxForm field gaps, compact sections
medium16pxStandard padding, paragraph spacing
large24pxSection padding, card content
xlarge32pxSection margins, major divisions
xxlarge40pxPage section spacing
xxxlarge56pxHero sections, major page divisions

Other Size Tokens

TokenValueUse
container.maxWidth1140pxMain content container width
border.standard2pxDefault border thickness

Usage

import theme from '@shelter-england/theme';

// Spacing
theme.size.spacing.medium; // '16px'
theme.size.spacing.large; // '24px'

// Container
theme.size.container.maxWidth; // '1140px'

// Border
theme.size.border.standard; // '2px'
import styled from 'styled-components';

const Card = styled.div`
padding: ${({ theme }) => theme.size.spacing.large};
margin-bottom: ${({ theme }) => theme.size.spacing.medium};
`;