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
Rename leading-* to lh-* and use numeric scale #664
Conversation
leading-*
to lh-*
and use numeric scaleleading-*
to lh-*
and use numeric scale
If you're going to use a numeric scale, please don't use a scale that tracks directly to the default values. In one of my projects, Just a thought. |
I honestly never had an issue with a single class name, so I personally don't see the benefit in breaking changes. That being said, decimals in class names looks awkward and I would love to avoid that. I've never needed more than 3 line height sizes in any site i've ever done, so normal, loose, and tight is more than adequate, and fantastically descriptive. Additionally, whenever you change a font, and line-height change can be necessary,I don't look forward to having to update You can always go with relative modifiers. |
Still in favor of “line” over “lh”
Singular is better #664 (comment) |
I think the reduction of ambiguity is worth the introduction of the decimal. |
@sandren What if you need to change your line-heigh thought? Do you want to find & replace all occurrences of 1.5 with 1.75 or whatever? |
My big problem is the one I outlined in the original message, which is that |
@adamwathan Just change the default values. I do. To me, none is not |
@jackmcdade Nothing stopping you from using descriptive names even if the defaults are numeric though right? I still want the defaults to be as good as we can make them and agree the defaults nudge people in a certain direction though. For some reason I don't love
What name do you use for |
#EmmetLivesMatter 😃 😃 😢 |
I think this is a common issue as what is considered "normal" leading is unique to each project and even each typeface within that project. It seems that avoiding this change only forces customization, which is something we are trying to avoid in the v1.0 release (see changes to the configuration). |
I rarely use 1, it almost never looks right to me. :) But if I did, I would use |
@jackmcdade A I'm really undecided on this one. I am not a fan of |
@zaknesler Tailwind already sucks with Emmet because of the variant classes ( |
Ah, I didn't realize this was a new goal. I guess it makes a little bit more sense then. |
I would say the goal is just to make the defaults better suited for more projects, because lots of people already don't customize. Picking bad defaults that force people to always customize is definitely something I want to avoid, but I don't think any of the ideas in this thread really fall under that category, they all have merit. |
@benface The only thing I don't like about
...just doesn't feel as correct as saying "set the height of a single line to x" – it feels like I'm saying "set the space between lines to x", and if there are never multiple lines then it feels like I'm setting something over here because of a coincidental effect it has on this thing over there, you know? |
Totally. That's a good point. |
But the words "tight" and "loose" also refer to the spacing between lines rather than the height of a line. |
I think that’s why it’s better singular <button class=“line-3 letter-2”> |
All the more reason to support the merge. 😅 |
Yeah, that's kinda why I like the numbers, but I don't hate the descriptive terms either, I definitely prefer I just hate the idea of having a |
You're never going to get the name, the term, and the plugin convention perfect because the css spec is a mess. Go with your gut and ship it. |
I WILL GET IT PERFECT IF IT KILLS ME JACK. |
What about following the same naming as the font sizes
I would not trigger a big discussion, but going for
I would have been more prone to use |
I hate to be that guy but imo Here's the thing: If we're okay with getting rid of almost everything in the config file because users can look things up on the docs, do we really need to change this? Is this a real issue that we need to solve? Because if it's not I'd just leave the way it is seeing how many opinions everyone has about it (second most commented PR in the repo, third most commented post if we're counting issues) and how even Adam looks unsure this is needed. Maybe core plugins should be named after the CSS property or module they're related to and the class name they output be a completely different thing? It wouldn't be that bad now that users are going to (almost?) be able to configure their own class names. |
@adamwathan You'll never please everyone. I hope you see the point I made on twitter about allowing the names to be configurable. There is such a wide variety of opinions on naming, why not let the user easily change the naming to what suits them? That doesn't take anything away from an awesome set of defaults that many people will use as is. |
Custom names is a bit overkill when most are voicing opinions only because they are asked, but that doesn’t warrant a need for custom names just because people are pitching ideas and being a designer doesn’t help the many of developers who aren’t, I think it’s wise and painless to move away from print concepts for mass appeal for those who use css to now use utility css |
leading-*
to lh-*
and use numeric scale
The change is from |
Please go with the numeric scale as opposed to something like The problem with these non numeric descriptors is that they leave no wiggle room, if I need a value between I'm also going to note I feel the same way about t-shirt sizes, |
But they're not print concepts. They are typographical concepts and the terms are completely appropriate for the web. |
I think I agree with @jackmcdade on this one. I usually use this in my config for leading:
And often have |
@sandren sorry, replace “print” with “design” If you can’t see my point it’s cause you’re a designer :) not saying it’s wrong, I’m saying it’s not intuitive to people who write css without being a designer. |
Guilty as charged. 😅 |
Decided to just leave everything as is, more here: #667 (comment) No point breaking people's sites for a class name change that I'm not even sure is actually better. |
This PR changes the name of our line-height classes from
leading-*
tolh-*
.leading-none
lh-1
leading-tight
lh-1.25
leading-normal
lh-1.5
leading-loose
lh-2
Changing the class prefix
The primary motivation for this is to make the naming mirror the CSS property more closely, as leading is an unfamiliar term to many. I considered
line-height-*
andline-h-*
as well, but based on a Twitter poll I ran, people preferred thelh-*
abbreviation (and so do I).I noticed GitHub uses this prefix in Primer which also made me feel more comfortable with it, since in general they tend to use more verbose names than Tailwind.
Switching to a numeric scale
One of the most annoying things about
leading-normal
to me is that on almost every project I work on, I set the default line-height toleading-tight
right on the<body>
tag. So my "normal" line-height istight
, andleading-normal
isn't normal at all. I could change the value ofleading-normal
to be1.25
on those projects, but then what name should I use for1.5
?On top of that, it's hard to introduce new values in the existing descriptive scale. Switching to a literal numeric scale makes that trivial.
In general, I don't think the descriptive scale is a useful abstraction in this case. Users can always add descriptive value if they like, like
lh-copy
,lh-heading
, etc. but I think starting with literal values serves people better by default with no real downside.Changing the core plugin name
This PR also changes the core plugin name from
leading
tolineHeight
, so line-height values would be customized by editing thelineHeight
key in the theme section of your config, and variants would be customized by editing thelineHeight
key in the variants section of your config. This is in line with #656 and along with the class name change, and makes these settings more easily guessable.