Skip to content

Commit f55566e

Browse files
MartijnCuppensXhmikosR
authored andcommitted
Add configurable button text wrapping (#29554)
1 parent 7ecfa6a commit f55566e

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

scss/_buttons.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
font-weight: $btn-font-weight;
1111
color: $body-color;
1212
text-align: center;
13+
white-space: $btn-white-space;
1314
vertical-align: middle;
1415
cursor: if($enable-pointer-cursor-for-buttons, pointer, null);
1516
user-select: none;

scss/_variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ $btn-padding-x: $input-btn-padding-x !default;
419419
$btn-font-family: $input-btn-font-family !default;
420420
$btn-font-size: $input-btn-font-size !default;
421421
$btn-line-height: $input-btn-line-height !default;
422+
$btn-white-space: null !default; // Set to `nowrap` to prevent text wrapping
422423

423424
$btn-padding-y-sm: $input-btn-padding-y-sm !default;
424425
$btn-padding-x-sm: $input-btn-padding-x-sm !default;

site/docs/4.3/components/buttons.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Bootstrap includes several predefined button styles, each serving its own semant
2020

2121
{% include callout-warning-color-assistive-technologies.md %}
2222

23+
## Disable text wrapping
24+
25+
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.
26+
2327
## Button tags
2428

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

0 commit comments

Comments
 (0)