Tailwindcss: [Feature Proposal / Discussion] font vs text

Created on 27 Jul 2019  Â·  4Comments  Â·  Source: tailwindlabs/tailwindcss

I'm wondering if it's necessary to use both the words text and font for Typography, maybe just going w/ text would make things simpler?

We already use text for things like font-size and font-style. It might be a bit easier to just pick one or the other.

If we went with text I believe it would just mean using the word text for font-family and font-weight.

Most helpful comment

font and text are basically different namespaces. Unifying them means possibly more clashes. Example: If a font you use is called like a color you use.

This is the reason we chose to keep them separate. The way to remember them is font- is used for anything that actually loads a different font file (font family and font weight), and text- is for changing something about the text that doesn't load a new font.

I originally had wt- for font weight but Jonathan hated it 🙃. I considered switching to weight- but it's just so long, so we decided to stick with font-.

No plans to unify this because text-light for example could be both a color and a weight in the same project.

All 4 comments

I would change text-{size} to font-{size} as what we really change is the font-size property. Other than that, I think it is nice to have all colors under the same prefix (text-{color}) — in this case we are changing the color property, but using text-white makes more sense than color-white in my opinion.

This is also the one area where I always have to think which one I have to use vs most other keywords I memorized right away. That being said I see at least two counter arguments:

  • font and text are basically different namespaces. Unifying them means possibly more clashes. Example: If a font you use is called like a color you use.
  • Tailwind is at version 1 now. Breaking changes have to be justified very well.

Tailwind is at version 1 now. Breaking changes have to be justified very well.

For this reason I wouldn't change them. Maybe if Tailwind hits version 2.0 it would be good to reconsider :)

font and text are basically different namespaces. Unifying them means possibly more clashes. Example: If a font you use is called like a color you use.

This is the reason we chose to keep them separate. The way to remember them is font- is used for anything that actually loads a different font file (font family and font weight), and text- is for changing something about the text that doesn't load a new font.

I originally had wt- for font weight but Jonathan hated it 🙃. I considered switching to weight- but it's just so long, so we decided to stick with font-.

No plans to unify this because text-light for example could be both a color and a weight in the same project.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dbpolito picture dbpolito  Â·  3Comments

spyric picture spyric  Â·  3Comments

smbdelse picture smbdelse  Â·  3Comments

benface picture benface  Â·  3Comments

divdax picture divdax  Â·  3Comments