Skip to content

Commit

Permalink
Add box-shadow utilities (#25758)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdo authored Apr 1, 2018
1 parent a016cbd commit dd7ed79
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions _data/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
- title: Image replacement
- title: Position
- title: Screenreaders
- title: Shadows
- title: Sizing
- title: Spacing
- title: Text
Expand Down
19 changes: 19 additions & 0 deletions docs/4.0/utilities/shadows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
layout: docs
title: Shadows
description: Add or remove shadows to elements with `box-shadow` utilities.
group: utilities
toc: false
---

## Examples

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).

{% capture example %}
<div class="shadow-none p-3 mb-5 bg-light rounded">No shadow</div>
<div class="shadow-sm p-3 mb-5 bg-white rounded">Small shadow</div>
<div class="shadow p-3 mb-5 bg-white rounded">Regular shadow</div>
<div class="shadow-lg p-3 mb-5 bg-white rounded">Larger shadow</div>
{% endcapture %}
{% include example.html content=example %}
1 change: 1 addition & 0 deletions scss/_utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@import "utilities/float";
@import "utilities/position";
@import "utilities/screenreaders";
@import "utilities/shadows";
@import "utilities/sizing";
@import "utilities/spacing";
@import "utilities/text";
Expand Down
4 changes: 4 additions & 0 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ $border-radius: .25rem !default;
$border-radius-lg: .3rem !default;
$border-radius-sm: .2rem !default;

$box-shadow-sm: 0 .125rem .25rem rgba($black, .075) !default;
$box-shadow: 0 .5rem 1rem rgba($black, .15) !default;
$box-shadow-lg: 0 1rem 3rem rgba($black, .175) !default;

$component-active-color: $white !default;
$component-active-bg: theme-color("primary") !default;

Expand Down
6 changes: 6 additions & 0 deletions scss/utilities/_shadows.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// stylelint-disable declaration-no-important

.shadow-sm { box-shadow: $box-shadow-sm !important; }
.shadow { box-shadow: $box-shadow !important; }
.shadow-lg { box-shadow: $box-shadow-lg !important; }
.shadow-none { box-shadow: none !important; }

0 comments on commit dd7ed79

Please sign in to comment.