-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 radius-*
utilities and deprecate rounded-*
utilities
#14912
base: next
Are you sure you want to change the base?
Conversation
4c7d7b9
to
13f1106
Compare
{ | ||
// border-radius | ||
// Deprecated: `rounded` utilities |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish we could generate a /* @deprecated */
comment next to the utility so that it shows in some editors as deprecated. But Lightning CSS sadly strips comments away (or their internal parser does).
13f1106
to
fed942b
Compare
@@ -50,7 +51,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
- Rename `shadow` to `shadow-sm`, `shadow-sm` to `shadow-xs`, and `shadow-xs` to `shadow-2xs` ([#14849](https://github.com/tailwindlabs/tailwindcss/pull/14849)) | |||
- Rename `inset-shadow` to `inset-shadow-sm`, `inset-shadow-sm` to `inset-shadow-xs`, and `inset-shadow-xs` to `inset-shadow-2xs` ([#14849](https://github.com/tailwindlabs/tailwindcss/pull/14849)) | |||
- Rename `drop-shadow` to `drop-shadow-sm` and `drop-shadow-sm` to `drop-shadow-xs` ([#14849](https://github.com/tailwindlabs/tailwindcss/pull/14849)) | |||
- Rename `rounded` to `rounded-sm` and `rounded-sm` to `rounded-xs` ([#14849](https://github.com/tailwindlabs/tailwindcss/pull/14849)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the change of moving the old scale to be deprecated as it was, I think we can revert this one, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mostly affects the codemod stuff, I think instead of mapping rounded
to rounded-sm
etc. we should map it to the new radius-*
utilities but leave the values as-is 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah wait this is more complicated, we can only migrate to radius-*
when we the value is defined in the JS config, the compat layer only works rounded-*
utilities
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess also only if the theme is overwritten. 🤔
Consider this configuration:
{
extend: {
borderRadius: {
'4xl': '2rem',
},
}
}
I expect this to create a --radius-4xl: 2rem
variable (which it does currently) however, the other breakpoints will now be in the --rounded
namespace, causing an inconsistency now because radius-4xl
exists but radius-3xl
doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the v4 equivalent is actually
rounded => radius-1
rounded-sm => radius-0.5
rounded-md => radius-1.5
rounded-custom => radius-custom
etc.
if custom happens to be 4xl
: not much we do here I think, although it would be cool if we can convert it to radius-8
but there might be an inherent meaning to the name so that's probably hard to do.
This PR adds a new set of
radius-*
utilities to replace the existingrounded-*
utilities.These utilities derive their values from the
--spacing-*
scale by default, but can also be configured with radius-specific values using the--radius-*
scale.This change makes it easier to do things like concentric border radiuses, where you need to subtract the padding of the parent when calculating the child radius:
Using the old t-shirt scale there was no clear connection to the spacing value which made this sort of thing annoying, and also difficult to notice that the value was carefully chosen to be concentric when reading the code.
I've kept the
rounded-*
utilities around for backwards compatibility, including the old t-shirt scale but have registered asinline reference
so that they don't produce CSS variables by default. We plan to mark these as deprecated via IntelliSense though, and also plan to update our codemod tooling to make it easy to migrate fromrounded-*
toradius-*
automatically.