Skip to content

Shadow

Two shadow mixins with a 1–5 depth scale. Shadow appearance is driven by config — hardness, direction, and offset base all affect the output.

See live demos →


Applies a two-layer box shadow — a tight top shadow and a softer bottom shadow that combine to create convincing depth:

@include shadow; // depth 2 — default
@include shadow(1); // subtle
@include shadow(3); // medium
@include shadow(5); // dramatic
ParameterDefaultDescription
$depth2Shadow depth — 1 to 5

Inset shadow — depth pressed into the surface. Use for inputs, wells, and pressed states:

@include shadow-inset; // depth 2 — default
@include shadow-inset(1); // subtle
@include shadow-inset(3); // deep
ParameterDefaultDescription
$depth2Shadow depth — 1 to 5

Shadow appearance is controlled by three config values:

ConfigDefaultEffect
$shadow-hardness51–10 — controls blur radius and opacity
$shadow-direction"none"Light source direction
$shadow-offset-base2pxBase offset amount

Controls how sharp or soft the shadow appears:

ValueCharacter
1–3Soft, diffuse — ambient light
4–6Balanced — default range
7–9Hard, defined — directional light
10No blur — solid cutout shadow

Where the light source is — not where the shadow falls:

ValueLight sourceShadow falls
"none"OverheadStraight down
"left"From leftTo the right
"right"From rightTo the left

Each depth level produces two shadow layers:

  • Top shadow — tighter, less blur, negative spread. Simulates the sharp shadow close to the element.
  • Bottom shadow — softer, more blur, larger offset. Simulates the diffuse shadow further from the element.

Both layers use only rgba(0, 0, 0, alpha) — no color in shadows, ensuring they work correctly on any background color.