Skip to content

Commit

Permalink
Add configurable button text wrapping (twbs#29554)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartijnCuppens authored and lucanos committed Oct 27, 2019
1 parent a0ae592 commit 9458235
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions scss/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
line-height: $btn-line-height;
color: $body-color;
text-align: center;
white-space: $btn-white-space;
vertical-align: middle;
cursor: if($enable-pointer-cursor-for-buttons, pointer, null);
user-select: none;
Expand Down
1 change: 1 addition & 0 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ $btn-padding-x: $input-btn-padding-x !default;
$btn-font-family: $input-btn-font-family !default;
$btn-font-size: $input-btn-font-size !default;
$btn-line-height: $input-btn-line-height !default;
$btn-white-space: null !default; // Set to `nowrap` to prevent text wrapping

$btn-padding-y-sm: $input-btn-padding-y-sm !default;
$btn-padding-x-sm: $input-btn-padding-x-sm !default;
Expand Down
4 changes: 4 additions & 0 deletions site/content/docs/4.3/components/buttons.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ Bootstrap includes several predefined button styles, each serving its own semant
{{< partial "callout-warning-color-assistive-technologies.md" >}}
{{< /callout >}}

## Disable text wrapping

If you don't want the button text to wrap, you can add the `.text-nowrap` class to the button. In Sass, you can set `$btn-white-space: nowrap` to disable text wrapping for each button.

## Button tags

The `.btn` classes are designed to be used with the `<button>` element. However, you can also use these classes on `<a>` or `<input>` elements (though some browsers may apply a slightly different rendering).
Expand Down

0 comments on commit 9458235

Please sign in to comment.