No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

Depth

Using depth can be an important design technique to highlight certain elements, give a sense of visual hierarchy and more.

Applying depth

To add depth to anything you can use the ab-container utility component. It allows you to apply depth by using certain modifiers.

Example

Show source
Oh no! The source is not available.

Depth

Class (CSS)Attribute (Web Component)
ab-container--depth-nonedepth="none"
ab-container--depth-100depth="100"
ab-container--depth-200depth="200"
ab-container--depth-300depth="300"
ab-container--depth-400depth="400"
ab-container--depth-500depth="500"
ab-container--depth-500depth="600"

The variables

Root's has 10 depth variables.

SizeVariableValue
None--ab-depth-nonenone
50--ab-depth-500px 0px 0px 1px rgba(0, 0, 0, 0.05);
100--ab-depth-1000px 1px 2px 0px rgba(0, 0, 0, 0.1);
200--ab-depth-2000px 1px 2px 0px rgba(0, 0, 0, 0.06), 0px 1px 3px 0px rgba(0, 0, 0, 0.14);
300--ab-depth-3000px 2px 4px -1px rgba(0, 0, 0, 0.11), 0px 4px 6px -1px rgba(0, 0, 0, 0.15);
400--ab-depth-4000px 2px 10px -1px rgba(0, 0, 0, 0.11), 0px 10px 15px -3px rgba(0, 0, 0, 0.15);
500--ab-depth-5000px 10px 10px -5px rgba(0, 0, 0, 0.11), 0px 20px 25px -5px rgba(0, 0, 0, 0.15);
600--ab-depth-600inset 0px 2px 4px 0px rgba(49, 39, 39, 0.06);
Inner--ab-depth-inner0px 25px 50px -12px rgba(41, 27, 27, 0.3);
Outline--ab-depth-outline0px 0px 0px 3px rgba(66, 153, 225, 0.5);

The border variables can be applied to the border property like this:

.my-card {
  box-shadow: var(--depth-100);
}