Skip to content

add .text-wrap class - #27568

Merged
XhmikosR merged 3 commits into
twbs:v4-devfrom
browner12:text-wrap
Nov 4, 2018
Merged

XhmikosR merged 3 commits into
twbs:v4-devfrom
browner12:text-wrap

Conversation

@browner12

@browner12 browner12 commented Oct 31, 2018 •

Copy link
Copy Markdown
Contributor

this is the opposite of .text-nowrap, and a forces elements to wrap onto new lines.

One use case for this is extra long button text. Bootstrap buttons by default do no wrap, so this class could be used to override that behavior.

references issue #19315

@MartijnCuppens
MartijnCuppens requested a review from a team October 31, 2018 16:04
@MartijnCuppens

Copy link
Copy Markdown
Member

Hi @browner12,

There is a difference between white-space: normal and word-wrap: break-word; or hyphens: auto;. The utility class you provide doesn't do the same as was done in the ticket you're referring to.

Bootstrap buttons by default do no wrap

This has been changed lately: 24bdadf#diff-8a4fc4262c9197c73b80fb80d8863ae5

So at the moment there's not really a reason to add this I think.

@browner12

Copy link
Copy Markdown
Contributor Author

The reason I stuck with white-space here is because that's what .text-nowrap uses, so IMO .text-wrap should be the opposite.

Even though without the button behavior, I think this is a good small complement to the existing utility class.

@twbs twbs deleted a comment from browner12 Oct 31, 2018
@MartijnCuppens

Copy link
Copy Markdown
Member

I'm not fully convinced yet. Could you maybe provide a demo to show its use-case?

@browner12

Copy link
Copy Markdown
Contributor Author

There are other components in Bootstrap that by default have a white-space: nowrap;. Badges, dropdown items, navbar brands, and progress bars. A user could also have some custom classes in their code that employ a nowrap.

This class would allow users to override that behavior on an individual basis.

<div style="width: 100px; border: 1px solid red; ">
    <div class="badge badge-primary text-wrap">testing a very long badge name</div>
    <div class="badge badge-primary">testing a very long badge name</div>
</div>

<style>
    .text-wrap {
        white-space: normal;
    }
</style>

screen shot 2018-11-02 at 9 18 24 am

@XhmikosR XhmikosR changed the title [4.2] add .text-wrap class add .text-wrap class Nov 4, 2018
@mdo mdo mentioned this pull request Nov 4, 2018
@XhmikosR

XhmikosR commented Nov 4, 2018

Copy link
Copy Markdown
Member

Shouldn't we add this in docs too?

@MartijnCuppens MartijnCuppens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we should add this to the docs.

@XhmikosR

XhmikosR commented Nov 4, 2018

Copy link
Copy Markdown
Member

@MartijnCuppens: I made the changes, have a look again and then I'll clean the branch and merge.

@MartijnCuppens

Copy link
Copy Markdown
Member

white-space: normal is the default behaviour, so I've changed the example to a badge, which makes it clear that this class can be used to override style set in css.

browner12 and others added 3 commits November 4, 2018 15:49
this is the opposite of `.text-nowrap`, and a forces elements to wrap onto new lines.

One use case for this is extra long button text. Bootstrap buttons by default do no wrap, so this class could be used to override that behavior.
@XhmikosR
XhmikosR merged commit b67c6fb into twbs:v4-dev Nov 4, 2018
@browner12

Copy link
Copy Markdown
Contributor Author

thanks guys!

@browner12
browner12 deleted the text-wrap branch November 4, 2018 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants