Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add .text-wrap class #27568

Merged
merged 3 commits into from
Nov 4, 2018
Merged

add .text-wrap class #27568

merged 3 commits into from
Nov 4, 2018

Conversation

browner12
Copy link
Contributor

@browner12 browner12 commented Oct 31, 2018

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
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
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
Member

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

@browner12
Copy link
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
Copy link
Member

XhmikosR commented Nov 4, 2018

Shouldn't we add this in docs too?

Copy link
Member

@MartijnCuppens MartijnCuppens left a comment

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
Copy link
Member

XhmikosR commented Nov 4, 2018

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

@MartijnCuppens
Copy link
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.
@browner12
Copy link
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