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 support for text-wrap property #11320

Merged
merged 1 commit into from
May 30, 2023
Merged

Add support for text-wrap property #11320

merged 1 commit into from
May 30, 2023

Conversation

adamwathan
Copy link
Member

This PR adds support for the new text-wrap CSS property, with the following three utilities:

Class CSS
text-wrap text-wrap: wrap
text-nowrap text-wrap: nowrap
text-balance text-wrap: balance

The most interesting one here is text-balance that attempts to automatically balance text across multiple lines so that you don't have one really long line and one really short line.

image

With the addition of the new text-wrap property, the CSS white-space property now decomposes into text-wrap and the new white-space-collapse property, but we are opting to leave explicit support for white-space-collapse to a future improvement for now because none of this stuff is supported anywhere except for the very latest version of Chrome.

This still feels useful for now though because text-balance gracefully degrades back to regular unbalanced text which doesn't look as nice but doesn't actually break the experience for anyone, so people might want to start using it today even if browser support is still catching up.

src/corePlugins.js Outdated Show resolved Hide resolved
tests/basic-usage.test.css Outdated Show resolved Hide resolved
@adamwathan adamwathan merged commit cb1a0e1 into master May 30, 2023
10 checks passed
@adamwathan adamwathan deleted the text-wrap branch May 30, 2023 19:26
@mrleblanc101
Copy link

When will this land ?

@Karobwe
Copy link

Karobwe commented Jul 31, 2023

Right now it can be used as arbitrary property: [text-wrap:balance]

@AhmedBaset
Copy link

When will this land ?

You can use it in the insiders:

npm install tailwindcss@insiders

@tremby
Copy link

tremby commented Nov 28, 2023

Is this still only in the insiders branch? I don't see it in docs, or this ticket number mentioned in release notes.

@gavalierm
Copy link

You can do this in main.css in laravel like so for nowdays stable release

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer utilities {
  .text-balance {
    text-wrap: balance;
  }
}

@nicooprat
Copy link

@tremby it's still in the "unreleased" section of the changelog so we'll have to wait a bit ;)

- Add `text-wrap` utilities including `text-balance` and `text-pretty` ([#11320](https://github.com/tailwindlabs/tailwindcss/pull/11320), [#12031](https://github.com/tailwindlabs/tailwindcss/pull/12031))

thecrypticace pushed a commit that referenced this pull request Dec 4, 2023
Update changelog

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
thecrypticace pushed a commit that referenced this pull request Dec 5, 2023
Update changelog

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
thecrypticace pushed a commit that referenced this pull request Dec 18, 2023
Update changelog

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
themaxgross added a commit to themaxgross/tailwindcss-text-balance that referenced this pull request Jan 15, 2024
themaxgross added a commit to themaxgross/tailwindcss-text-balance that referenced this pull request Jan 15, 2024
@themaxgross
Copy link

I created a plugin as a package for my own use a while ago since I didn't know about this, and I've just updated it to support text-wrap as well. Hope people will find it useful as a drop-in until it's released in tailwind main~

https://github.com/theleoji/tailwindcss-text-balance

@Jarpiino
Copy link

Jarpiino commented Jan 15, 2024

I created a plugin as a package for my own use a while ago since I didn't know about this, and I've just updated it to support text-wrap as well. Hope people will find it useful as a drop-in until it's released in tailwind main~

https://github.com/theleoji/tailwindcss-text-balance

Tailwind supports text-wrap since 19th of January. They were waiting for Firefox support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants