Skip to content

Commit dd7ed79

Browse files
authored
Add box-shadow utilities (#25758)
1 parent a016cbd commit dd7ed79

File tree

5 files changed

+31
-0
lines changed

5 files changed

+31
-0
lines changed

_data/nav.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
- title: Image replacement
6565
- title: Position
6666
- title: Screenreaders
67+
- title: Shadows
6768
- title: Sizing
6869
- title: Spacing
6970
- title: Text

docs/4.0/utilities/shadows.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
layout: docs
3+
title: Shadows
4+
description: Add or remove shadows to elements with `box-shadow` utilities.
5+
group: utilities
6+
toc: false
7+
---
8+
9+
## Examples
10+
11+
While shadows on components are disabled by default in Bootstrap and can be enabled via `$enable-shadows`, you can also quickly add or remove a shadow with our `box-shadow` utility classes. Includes support for `.shadow-none` and three default sizes (which have associated variables to match).
12+
13+
{% capture example %}
14+
<div class="shadow-none p-3 mb-5 bg-light rounded">No shadow</div>
15+
<div class="shadow-sm p-3 mb-5 bg-white rounded">Small shadow</div>
16+
<div class="shadow p-3 mb-5 bg-white rounded">Regular shadow</div>
17+
<div class="shadow-lg p-3 mb-5 bg-white rounded">Larger shadow</div>
18+
{% endcapture %}
19+
{% include example.html content=example %}

scss/_utilities.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
@import "utilities/float";
99
@import "utilities/position";
1010
@import "utilities/screenreaders";
11+
@import "utilities/shadows";
1112
@import "utilities/sizing";
1213
@import "utilities/spacing";
1314
@import "utilities/text";

scss/_variables.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ $border-radius: .25rem !default;
212212
$border-radius-lg: .3rem !default;
213213
$border-radius-sm: .2rem !default;
214214

215+
$box-shadow-sm: 0 .125rem .25rem rgba($black, .075) !default;
216+
$box-shadow: 0 .5rem 1rem rgba($black, .15) !default;
217+
$box-shadow-lg: 0 1rem 3rem rgba($black, .175) !default;
218+
215219
$component-active-color: $white !default;
216220
$component-active-bg: theme-color("primary") !default;
217221

scss/utilities/_shadows.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// stylelint-disable declaration-no-important
2+
3+
.shadow-sm { box-shadow: $box-shadow-sm !important; }
4+
.shadow { box-shadow: $box-shadow !important; }
5+
.shadow-lg { box-shadow: $box-shadow-lg !important; }
6+
.shadow-none { box-shadow: none !important; }

0 commit comments

Comments
 (0)