Utilities
Shadows
Add or remove shadows to elements with box-shadow utilities — two depths, both from the design tokens.
How it works
Bootstrap ships three shadow sizes. This theme maps them onto the two RopeBreak.net shadow tokens, so
.shadow and .shadow-lg are the same value. The tint is navy-900, not black, so
the shadow reads as part of the palette rather than a grey smudge. Both deepen automatically in dark mode
(see Color modes).
| Class | Token | Light | Dark |
|---|---|---|---|
.shadow-sm | --shadow-sm | 0 1px 2px rgba(10, 27, 61, .08) | 0 1px 2px rgba(0, 0, 0, .4) |
.shadow | --shadow-md | 0 4px 12px rgba(10, 27, 61, .16) | 0 4px 12px rgba(0, 0, 0, .5) |
.shadow-lg | --shadow-md | 0 4px 12px rgba(10, 27, 61, .16) | 0 4px 12px rgba(0, 0, 0, .5) |
.shadow-none | — | none | none |
$enable-shadows is off and no component carries a shadow by default. See
Brand overview.Examples
While shadows on components are disabled by default in this theme and can be enabled via
$enable-shadows, you can also quickly add or remove a shadow with our box-shadow
utility classes.
HTML
<div class="shadow-none p-3 mb-5 bg-body-tertiary rounded">No shadow</div>
<div class="shadow-sm p-3 mb-5 bg-body-tertiary rounded">Small shadow</div>
<div class="shadow p-3 mb-5 bg-body-tertiary rounded">Regular shadow</div>
<div class="shadow-lg p-3 mb-5 bg-body-tertiary rounded">Larger shadow (same value as regular in this theme)</div>
The utilities read the --bs-box-shadow-* variables, so the dark-mode swap happens with no extra
class. Here is the same set inside a forced-dark region:
HTML
<div data-bs-theme="dark" class="p-4 bg-body rounded">
<div class="shadow-sm p-3 mb-4 bg-body-tertiary rounded">Small shadow, dark</div>
<div class="shadow p-3 bg-body-tertiary rounded">Regular shadow, dark</div>
</div>When to use which
.shadow-sm— a lifted control that is still part of the page surface: a floating action, a dragged list item..shadow— anything in the top layer: dropdown menus, popovers, toasts, the modal box..shadow-lg— kept for markup compatibility with stock Bootstrap. Prefer.shadow..shadow-none— strip a shadow that a third-party snippet or an$enable-shadowsbuild added.
CSS
Variables
The utilities point at root-level custom properties, which in turn are aliased by the token layer
(--shadow-sm, --shadow-md). Override the variables on any ancestor to retune every
shadow inside it.
:root, [data-bs-theme="light"] {
--bs-box-shadow: 0 4px 12px rgba(10, 27, 61, 0.16);
--bs-box-shadow-sm: 0 1px 2px rgba(10, 27, 61, 0.08);
--bs-box-shadow-lg: 0 4px 12px rgba(10, 27, 61, 0.16);
--shadow-sm: var(--bs-box-shadow-sm);
--shadow-md: var(--bs-box-shadow);
}
[data-bs-theme="dark"] {
--bs-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
--bs-box-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
--bs-box-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.5);
}
Sass variables
// scss/_palette.scss
$rb-shadow-sm: 0 1px 2px rgba(10, 27, 61, 0.08) !default;
$rb-shadow-md: 0 4px 12px rgba(10, 27, 61, 0.16) !default;
$rb-shadow-sm-dark: 0 1px 2px rgba(0, 0, 0, 0.4) !default;
$rb-shadow-md-dark: 0 4px 12px rgba(0, 0, 0, 0.5) !default;
// scss/_variables.scss
$box-shadow: $rb-shadow-md;
$box-shadow-sm: $rb-shadow-sm;
$box-shadow-lg: $rb-shadow-md;
Utilities API
"shadow": (
property: box-shadow,
class: shadow,
values: (
null: var(--bs-box-shadow),
sm: var(--bs-box-shadow-sm),
lg: var(--bs-box-shadow-lg),
none: none,
)
),