Lumo Sizing and Spacing

Lumo defines a set of CSS custom properties you can use to apply consistent sizing and spacing across your application.

Size

Use these properties to adjust the sizing of regular elements (buttons, text fields, list items).

M is the standard size, and it is primarily used to size buttons, text fields and list items. If you adjust the sizing, make sure to keep it large enough for touch targets.

See Icons for properties that affect the sizing of icons.

--lumo-size-xs: 1.625rem

--lumo-size-s: 1.875rem

--lumo-size-m: 2.25rem

--lumo-size-l: 2.75rem

--lumo-size-xl: 3.5rem

Space

Use these properties to adjust the inter-component spacings: the space outside a regular component (button, text field) or inside a container component (layouts, grid cells).

Uniform

Use these properties for margin or padding in a single direction or uniformly on all sides.

--lumo-space-xs: 0.25rem

--lumo-space-s: 0.5rem

--lumo-space-m: 1rem

--lumo-space-l: 1.5rem

--lumo-space-xl: 2.5rem

Wide

Use these properties for margin or padding to have a bigger horizontal space than vertical space.

--lumo-space-wide-xs: calc( 0.25rem / 2) 0.25rem

--lumo-space-wide-s: calc( 0.5rem / 2) 0.5rem

--lumo-space-wide-m: calc( 1rem / 2) 1rem

--lumo-space-wide-l: calc( 1.5rem / 2) 1.5rem

--lumo-space-wide-xl: calc( 2.5rem / 2) 2.5rem

Tall

Use these properties for margin or padding to have a bigger vertical space than horizontal space.

--lumo-space-tall-xs: 0.25rem calc( 0.25rem / 2)

--lumo-space-tall-s: 0.5rem calc( 0.5rem / 2)

--lumo-space-tall-m: 1rem calc( 1rem / 2)

--lumo-space-tall-l: 1.5rem calc( 1.5rem / 2)

--lumo-space-tall-xl: 2.5rem calc( 2.5rem / 2)

Examples

Sizing

HTML

  1. <span class="size-xs">XS</span>
  2. <span class="size-s">S</span>
  3. <span class="size-m">M</span>
  4. <span class="size-l">L</span>
  5. <span class="size-xl">XL</span>
  6. <custom-style>
  7. <style>
  8. .size-xs {
  9. width: var(--lumo-size-xs);
  10. height: var(--lumo-size-xs);
  11. }
  12. .size-s {
  13. width: var(--lumo-size-s);
  14. height: var(--lumo-size-s);
  15. }
  16. .size-m {
  17. width: var(--lumo-size-m);
  18. height: var(--lumo-size-m);
  19. }
  20. .size-l {
  21. width: var(--lumo-size-l);
  22. height: var(--lumo-size-l);
  23. }
  24. .size-xl {
  25. width: var(--lumo-size-xl);
  26. height: var(--lumo-size-xl);
  27. }
  28. </style>
  29. </custom-style>

Spacing

Uniform

HTML

  1. <span class="space-xs">XS</span>
  2. <span class="space-s">S</span>
  3. <span class="space-m">M</span>
  4. <span class="space-l">L</span>
  5. <span class="space-xl">XL</span>
  6. <custom-style>
  7. <style>
  8. .space-xs {
  9. padding: var(--lumo-space-xs);
  10. }
  11. .space-s {
  12. padding: var(--lumo-space-s);
  13. }
  14. .space-m {
  15. padding: var(--lumo-space-m);
  16. }
  17. .space-l {
  18. padding: var(--lumo-space-l);
  19. }
  20. .space-xl {
  21. padding: var(--lumo-space-xl);
  22. }
  23. </style>
  24. </custom-style>

Wide

HTML

  1. <span class="space-wide-xs">XS</span>
  2. <span class="space-wide-s">S</span>
  3. <span class="space-wide-m">M</span>
  4. <span class="space-wide-l">L</span>
  5. <span class="space-wide-xl">XL</span>
  6. <custom-style>
  7. <style>
  8. .space-wide-xs {
  9. padding: var(--lumo-space-wide-xs);
  10. }
  11. .space-wide-s {
  12. padding: var(--lumo-space-wide-s);
  13. }
  14. .space-wide-m {
  15. padding: var(--lumo-space-wide-m);
  16. }
  17. .space-wide-l {
  18. padding: var(--lumo-space-wide-l);
  19. }
  20. .space-wide-xl {
  21. padding: var(--lumo-space-wide-xl);
  22. }
  23. </style>
  24. </custom-style>

Tall

HTML

  1. <span class="space-tall-xs">XS</span>
  2. <span class="space-tall-s">S</span>
  3. <span class="space-tall-m">M</span>
  4. <span class="space-tall-l">L</span>
  5. <span class="space-tall-xl">XL</span>
  6. <custom-style>
  7. <style>
  8. .space-tall-xs {
  9. padding: var(--lumo-space-tall-xs);
  10. }
  11. .space-tall-s {
  12. padding: var(--lumo-space-tall-s);
  13. }
  14. .space-tall-m {
  15. padding: var(--lumo-space-tall-m);
  16. }
  17. .space-tall-l {
  18. padding: var(--lumo-space-tall-l);
  19. }
  20. .space-tall-xl {
  21. padding: var(--lumo-space-tall-xl);
  22. }
  23. </style>
  24. </custom-style>