import { spacing } from '@sky-uk/ui-core';
spacing(1);
// returns
4px

You can return the spacing without a px suffix by passing false as a second argument. This is useful if you need to use the raw number for calculations.

spacing(1, false);
// returns
4;

Available Spacing Units

  • 0 = 0
  • 1 = 4px
  • 2 = 8px
  • 3 = 12px
  • 4 = 16px
  • 5 = 24px
  • 6 = 32px
  • 7 = 48px
  • 8 = 72px