Skip to content

Design tokens / Shadows

Shadows ​

Elevation levels, defined in packages/pixel/tokens/shadow.css.

TokenY offsetBlurSample
--shadow-level-0—none
--shadow-level-11px3px
--shadow-level-23px8px
--shadow-level-36px18px
--shadow-level-48px14px
--shadow-level-512px22px

Each level is a composite box-shadow — three stacked layers at different offsets and opacities, not a single value. That's what makes the depth read as light falling on an object rather than a grey blur behind it.

The higher the level, the more the element should read as sitting above the surface:

LevelFor
0The resting default. Most components never leave it.
1–2Something lifted off the page but still part of it — a hovered card, a raised bar.
3–4Floating over content — a dropdown, a popover.
5Detached from the page entirely — a modal, a drawer.

?> No kuba component uses a shadow today. Cards, buttons and inputs are all flat by design, distinguished by fill and border instead. These tokens exist for the product you build on top — reach for them when an element genuinely floats above others, not to add visual weight to something that doesn't.

preview
Code
html
<kb-stack direction="row" spacing="xs">
  <kb-card style="box-shadow: var(--shadow-level-2)">
    <kb-text size="xxs">Level 2</kb-text>
  </kb-card>
  <kb-card style="box-shadow: var(--shadow-level-4)">
    <kb-text size="xxs">Level 4</kb-text>
  </kb-card>
</kb-stack>

!> The shadows are tuned for light surfaces — they're black at low opacity. On a dark background they're nearly invisible, since a shadow can't darken what's already dark. Elevation in dark mode comes from a lighter surface color instead: step up the master ramp rather than adding a shadow.