diff --git a/scss/_buttons.scss b/scss/_buttons.scss
index 7381de533..3f767bb52 100644
--- a/scss/_buttons.scss
+++ b/scss/_buttons.scss
@@ -4,34 +4,48 @@
.btn {
display: inline-block;
+ padding: $btn-padding-y $btn-padding-x;
+ @include font-size($btn-font-size);
font-family: $btn-font-family;
font-weight: $btn-font-weight;
line-height: $btn-line-height;
- color: $body-color;
+ color: var(--btn-accent-contrast-color);
text-align: center;
text-decoration: if($link-decoration == none, null, none);
white-space: $btn-white-space;
vertical-align: middle;
cursor: if($enable-pointer-cursor-for-buttons, pointer, null);
user-select: none;
- background-color: transparent;
- border: $btn-border-width solid transparent;
- @include button-size($btn-padding-y, $btn-padding-x, $btn-font-size, $btn-border-radius);
+ background-color: var(--btn-accent-color);
+ border: $btn-border-width solid $btn-border-color;
+
@include transition($btn-transition);
+ @include gradient-bg();
+ @include border-radius($btn-border-radius, 0); // Manually declare to provide an override to the browser default
+ @include box-shadow($btn-box-shadow);
&:hover {
- color: $body-color;
+ color: var(--btn-accent-contrast-color);
text-decoration: if($link-hover-decoration == underline, none, null);
}
&:focus,
&.focus {
outline: 0;
- box-shadow: $btn-focus-box-shadow;
+
+ // Avoid using mixin so we can pass custom focus shadow properly
+ @if $enable-shadows {
+ box-shadow: $btn-box-shadow, $btn-focus-box-shadow;
+ } @else {
+ box-shadow: $btn-focus-box-shadow;
+ }
}
&:active,
- &.active {
+ &.active,
+ .show > &.dropdown-toggle {
+ // Remove CSS gradients if they're enabled
+ background-image: if($enable-gradients, none, null);
@include box-shadow($btn-active-box-shadow);
&:focus {
@@ -43,11 +57,37 @@
&.disabled,
fieldset:disabled & { // stylelint-disable-line selector-no-qualifying-type
pointer-events: none;
+ // Remove CSS gradients if they're enabled
+ background-image: if($enable-gradients, none, null);
opacity: $btn-disabled-opacity;
@include box-shadow(none);
}
}
+.btn-outline {
+ color: var(--btn-accent-color);
+ background-color: transparent;
+ border-color: currentColor;
+
+ &:hover {
+ background-color: var(--btn-accent-color);
+ border-color: var(--btn-accent-color);
+ }
+
+ &:focus,
+ &.focus {
+ color: var(--btn-accent-contrast-color);
+ background-color: var(--btn-accent-color);
+ border-color: var(--btn-accent-color);
+ }
+
+ &.active,
+ &:active {
+ color: var(--btn-accent-contrast-color);
+ background-color: var(--btn-accent-color);
+ border-color: var(--btn-accent-color);
+ }
+}
//
// Alternate buttons
@@ -55,26 +95,44 @@
@each $color, $value in $theme-colors {
.btn-#{$color} {
- @include button-variant($value, $value);
+ $contrast-color: color-contrast($value);
+
+ --btn-accent-color: #{$value};
+ --btn-accent-contrast-color: #{$contrast-color};
+
+ &:hover {
+ $accent-hover: darken($value, 5%);
+ $accent-hover-contrast-color: color-contrast($accent-hover);
+
+ --btn-accent-color: #{$accent-hover};
+ @if ($contrast-color != $accent-hover-contrast-color) {
+ --btn-accent-contrast-color: #{$accent-hover-contrast-color};
+ }
+ }
+
+ &.active,
+ &:active {
+ $accent-active: darken($value, 15%);
+ $accent-active-contrast-color: color-contrast($accent-active);
+
+ --btn-accent-color: #{$accent-active};
+ @if ($contrast-color != $accent-active-contrast-color) {
+ --btn-accent-contrast-color: #{$accent-active-contrast-color};
+ }
+ }
}
}
-@each $color, $value in $theme-colors {
- .btn-outline-#{$color} {
- @include button-outline-variant($value);
- }
-}
-
-
//
// Link buttons
//
// Make a button look and behave like a link
.btn-link {
- font-weight: $font-weight-normal;
+ font-weight: $font-weight-base;
color: $btn-link-color;
text-decoration: $link-decoration;
+ border-color: if($btn-border-color != transparent, transparent, null);
&:hover {
color: $btn-link-hover-color;
@@ -84,14 +142,13 @@
&:focus,
&.focus {
text-decoration: $link-hover-decoration;
+ box-shadow: 0 0 0 $btn-focus-offset $body-bg, 0 0 0 $btn-focus-width;
}
&:disabled,
&.disabled {
color: $btn-link-disabled-color;
}
-
- // No need for an active state here
}
@@ -99,12 +156,16 @@
// Button Sizes
//
-.btn-lg {
- @include button-size($btn-padding-y-lg, $btn-padding-x-lg, $btn-font-size-lg, $btn-border-radius-lg);
+.btn-sm {
+ padding: $btn-padding-y-sm $btn-padding-x-sm;
+ @include font-size($btn-font-size-sm);
+ @include border-radius($btn-border-radius-sm);
}
-.btn-sm {
- @include button-size($btn-padding-y-sm, $btn-padding-x-sm, $btn-font-size-sm, $btn-border-radius-sm);
+.btn-lg {
+ padding: $btn-padding-y-lg $btn-padding-x-lg;
+ @include font-size($btn-font-size-lg);
+ @include border-radius($btn-border-radius-lg);
}
diff --git a/scss/_mixins.scss b/scss/_mixins.scss
index 5a04655d5..76b2a67a6 100644
--- a/scss/_mixins.scss
+++ b/scss/_mixins.scss
@@ -21,7 +21,6 @@
// Components
@import "mixins/alert";
-@import "mixins/buttons";
@import "mixins/caret";
@import "mixins/pagination";
@import "mixins/lists";
diff --git a/scss/_variables.scss b/scss/_variables.scss
index 6123f3ce1..b30d1f039 100644
--- a/scss/_variables.scss
+++ b/scss/_variables.scss
@@ -534,12 +534,14 @@ $btn-padding-y-lg: $input-btn-padding-y-lg !default;
$btn-padding-x-lg: $input-btn-padding-x-lg !default;
$btn-font-size-lg: $input-btn-font-size-lg !default;
+$btn-border-color: rgba($black, .01) !default;
$btn-border-width: $input-btn-border-width !default;
$btn-font-weight: $font-weight-normal !default;
$btn-box-shadow: inset 0 1px 0 rgba($white, .15), 0 1px 1px rgba($black, .075) !default;
$btn-focus-width: $input-btn-focus-width !default;
-$btn-focus-box-shadow: $input-btn-focus-box-shadow !default;
+$btn-focus-offset: $input-btn-focus-width / 2 !default;
+$btn-focus-box-shadow: 0 0 0 $btn-focus-offset, 0 0 0 $input-btn-focus-width var(--btn-accent-color) !default;
$btn-disabled-opacity: .65 !default;
$btn-active-box-shadow: inset 0 3px 5px rgba($black, .125) !default;
diff --git a/scss/mixins/_buttons.scss b/scss/mixins/_buttons.scss
deleted file mode 100644
index 53a337ba0..000000000
--- a/scss/mixins/_buttons.scss
+++ /dev/null
@@ -1,121 +0,0 @@
-// Button variants
-//
-// Easily pump out default styles, as well as :hover, :focus, :active,
-// and disabled options for all buttons
-
-@mixin button-variant(
- $background,
- $border,
- $color: color-contrast($background),
- $hover-background: darken($background, 7.5%),
- $hover-border: darken($border, 10%),
- $hover-color: color-contrast($hover-background),
- $active-background: darken($background, 10%),
- $active-border: darken($border, 12.5%),
- $active-color: color-contrast($active-background)
-) {
- color: $color;
- @include gradient-bg($background);
- border-color: $border;
- @include box-shadow($btn-box-shadow);
-
- &:hover {
- color: $hover-color;
- @include gradient-bg($hover-background);
- border-color: $hover-border;
- }
-
- &:focus,
- &.focus {
- color: $hover-color;
- @include gradient-bg($hover-background);
- border-color: $hover-border;
- // Avoid using mixin so we can pass custom focus shadow properly
- @if $enable-shadows {
- box-shadow: $btn-box-shadow, 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5);
- } @else {
- box-shadow: 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5);
- }
- }
-
- &:active,
- &.active,
- .show > &.dropdown-toggle {
- color: $active-color;
- background-color: $active-background;
- // Remove CSS gradients if they're enabled
- background-image: if($enable-gradients, none, null);
- border-color: $active-border;
-
- &:focus {
- // Avoid using mixin so we can pass custom focus shadow properly
- @if $enable-shadows and $btn-active-box-shadow != none {
- box-shadow: $btn-active-box-shadow, 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5);
- } @else {
- box-shadow: 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5);
- }
- }
- }
-
- &:disabled,
- &.disabled {
- color: $color;
- background-color: $background;
- // Remove CSS gradients if they're enabled
- background-image: if($enable-gradients, none, null);
- border-color: $border;
- }
-}
-
-@mixin button-outline-variant(
- $color,
- $color-hover: color-contrast($color),
- $active-background: $color,
- $active-border: $color,
- $active-color: color-contrast($active-background)
-) {
- color: $color;
- border-color: $color;
-
- &:hover {
- color: $color-hover;
- background-color: $active-background;
- border-color: $active-border;
- }
-
- &:focus,
- &.focus {
- box-shadow: 0 0 0 $btn-focus-width rgba($color, .5);
- }
-
- &:active,
- &.active,
- &.dropdown-toggle.show {
- color: $active-color;
- background-color: $active-background;
- border-color: $active-border;
-
- &:focus {
- // Avoid using mixin so we can pass custom focus shadow properly
- @if $enable-shadows and $btn-active-box-shadow != none {
- box-shadow: $btn-active-box-shadow, 0 0 0 $btn-focus-width rgba($color, .5);
- } @else {
- box-shadow: 0 0 0 $btn-focus-width rgba($color, .5);
- }
- }
- }
-
- &:disabled,
- &.disabled {
- color: $color;
- background-color: transparent;
- }
-}
-
-// Button sizes
-@mixin button-size($padding-y, $padding-x, $font-size, $border-radius) {
- padding: $padding-y $padding-x;
- @include font-size($font-size);
- // Manually declare to provide an override to the browser default
- @include border-radius($border-radius, 0);
-}
diff --git a/scss/mixins/_gradients.scss b/scss/mixins/_gradients.scss
index cecabc913..64187d42d 100644
--- a/scss/mixins/_gradients.scss
+++ b/scss/mixins/_gradients.scss
@@ -1,14 +1,14 @@
// Gradients
-@mixin gradient-bg($color, $foreground: null) {
+@mixin gradient-bg($color: null, $foreground: null) {
+ background-color: $color;
+
@if $enable-gradients {
@if $foreground {
- background-image: $foreground, linear-gradient(180deg, mix($body-bg, $color, 15%), $color);
+ background-image: $foreground, linear-gradient(180deg, rgba($color, .15), transparent);
} @else {
- background-image: linear-gradient(180deg, mix($body-bg, $color, 15%), $color);
+ background-image: linear-gradient(180deg, rgba($body-bg, .15), transparent);
}
- } @else {
- background-color: $color;
}
}
diff --git a/site/content/docs/4.3/components/buttons.md b/site/content/docs/4.3/components/buttons.md
index b64dfdbec..74b9f45f2 100644
--- a/site/content/docs/4.3/components/buttons.md
+++ b/site/content/docs/4.3/components/buttons.md
@@ -44,12 +44,12 @@ When using button classes on `` elements that are used to trigger in-page fun
## Outline buttons
-In need of a button, but not the hefty background colors they bring? Replace the default modifier classes with the `.btn-outline-*` ones to remove all background images and colors on any button.
+In need of a button, but not the hefty background colors they bring? Replace the default modifier classes with the `.btn-outline btn-*` ones to remove all background images and colors on any button.
{{< example >}}
{{< buttons.inline >}}
{{- range (index $.Site.Data "theme-colors") }}
-
+
{{- end -}}
{{< /buttons.inline >}}
{{< /example >}}
diff --git a/site/content/docs/4.3/components/navbar.md b/site/content/docs/4.3/components/navbar.md
index 4ae3dddc4..8843f1c08 100644
--- a/site/content/docs/4.3/components/navbar.md
+++ b/site/content/docs/4.3/components/navbar.md
@@ -68,7 +68,7 @@ Here's an example of all the sub-components included in a responsive light-theme
@@ -223,7 +223,7 @@ Place various form controls and components within a navbar:
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
And an even wittier subheading to boot. Jumpstart your marketing efforts with this example based on Apple’s marketing pages.
- Coming soon + Coming soon