Skip to content

[Feature proposal] Normalize align/justify utilities #1647

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

Closed
sebastiandedeyne opened this issue Apr 29, 2020 · 2 comments
Closed

[Feature proposal] Normalize align/justify utilities #1647

sebastiandedeyne opened this issue Apr 29, 2020 · 2 comments

Comments

@sebastiandedeyne
Copy link
Contributor

sebastiandedeyne commented Apr 29, 2020

The align-* and justify-* related utilities currently use a short representation, e.g. items-center for align-items: center. This makes sense for flex, since you can get most things done with align-items and justify-content.

With grid being part of Tailwind now, additional align-* and justify-* properties became more prevalent. Some are missing, and some current utilities become ambiguous when filling the missing gaps. E.g. is justify-items utilities were to be added, it wouldn't be obvious anymore that items-center relate to align-items. Then there's also the place-* properties which will probably be added at some point too.

We could normalize the properties in a non-breaking way in 1.x by adding more utilities, and removing the old ones in 2.x.

Property Current Future
align-items items-* align-items-*
align-content content-* align-content-*
align-self self-* align-self-*
justify-items - justify-items-*
justify-content justify-* justify-content-*
justify-self - justify-self-*

Related issues: #1628, #1354, and maybe #1517.

@adamwathan
Copy link
Member

adamwathan commented Apr 29, 2020

Hey @sebastiandedeyne thanks for the thoughtful proposal!

I totally see the rationale behind this idea but personally I would be more inclined to leave the existing ones unchanged, and only use the more verbose naming for the new ones to disambiguate them from the existing ones, so:

Property Current Future
align-items items-* items-*
align-content content-* content-*
align-self self-* self-*
justify-items - justify-items-*
justify-content justify-* justify-*
justify-self - justify-self-*

Two reasons I would prefer this approach:

  1. It's not a breaking change. The impact and friction introduced by breaking changes are generally extremely underestimated by project maintainers and I think we should avoid breaking changes unless they fix a very painful problem that cannot otherwise be solved.

  2. It optimizes for the common use case. Both justify-items and justify-self do nothing in Flexbox layouts, so they are inherently far less used than justify-content and the align-items/content/self properties. Trying to normalize all of the naming means we all have to type class names that are 1.5x as long for stuff we use 99% of the time just to make things feel consistent with classes we will rarely use in comparison.

I'd rather optimize for the common use case (which also has the benefit of not being a breaking change) and have people use longer class names for the less used properties personally. We made a similar decision when introducing the delay-*, duration-*, and ease-* classes, optimizing for the most common use case (transitions) with the plan to add qualified animation-delay-*, animation-duration-*, etc. classes if/when we add utilities for animation properties.

@sebastiandedeyne
Copy link
Contributor Author

I totally respect the decision of optimizing for the common use case. Thanks for the detailed response!

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

No branches or pull requests

2 participants