-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 logical properties support for inline direction #10166
Conversation
For projects that use the existing plugin, it would be nice if there is syntax compatibility |
Great to see this, it was a bit of a challenge to support RTL |
Note for future Adam, maybe go with |
Cross referencing and wanted to point these out just in case. |
Woo! This doesn’t include documentation changes so the only thing I’m left wondering is how the still-recent browser support for this will be stated in the documentation. I see And again on browser support – worth mentioning flow-relative |
Note to self — merge |
Cool, 👍 I was just reading this: https://rtlstyling.com/posts/rtl-styling#css-logical-properties I think we are going to use Please release it ( We are going to support RLT, very soon, thanks ) |
3b90b53
to
e086241
Compare
Pushed a change that also uses logical properties for I deleted the previous |
This is important so that we can guarantee that `workspaces` are supported which we depend on right now (just for install purposes).
…orking right now)" This reverts commit a3deed4.
fb326c8
to
07377f7
Compare
+ fix oxide version tests
The normal `npm run test` will already include the non-oxide and oxide version when running tests.
Any chance this can be configurable? I understand the purpose of backward compatibility, but I wish my teams to use logical CSS properties always, unless, in some weird rare cases they need non-logical ones. Edit: I think I might achieve it through custom plugin, disabling the core one to avoid both properties set. I think |
@RobinMalfait We are working on the coding rules for supporting RTL, this feature would definitely help 👍 |
Thank you Adam for this I wrote plugin today to support this, I found finally, I wish to see |
Thank you for adding this ❤️ Hey @RobinMalfait. Do you have any update on when this will be released? |
Thanks for all the cool stuffs 👍 And for those who also waiting for this to be released 😂, plugin(function ({ matchUtilities, theme }) {
matchUtilities(
{
ms: (value) => ({
'margin-inline-start': value,
}),
me: (value) => ({
'margin-inline-end': value,
}),
ps: (value) => ({
'padding-inline-start': value,
}),
pe: (value) => ({
'padding-inline-end': value,
}),
start: (value) => ({
'inset-inline-start': value,
}),
end: (value) => ({
'inset-inline-end': value,
}),
},
{ values: theme('spacing') }
);
}), For space-x, I also tried to put it here; but:
|
I've been unable to find docs for this feature and I'm not getting autocomplete for it either with the vscode extension. GitHub is saying this PR first appeared in v3.2.5 (I'm on 3.2.7). Has this not actually been released yet? |
Hey @kentcdodds, indeed the feature is not yet released (https://github.com/tailwindlabs/tailwindcss/blob/master/CHANGELOG.md#added) you could play with the insiders version if you want to play with it:
|
How about using I'm not really a fan of |
I wonder what are the use cases to prefer config: {
cssLogicalProperties: {
'src/pages/[id]': true
}
} I understand it's too much effort, but we, as a community should be moving to a better inclusive technology. Even if many US start-ups don't care about RTL languages, they might eventually, with 0 cost, if started right. |
I think just prefixing the
I think that should be naming collision-free, but if you still don't want to use |
👋 browser support now feels good enough for flow-relative |
The padding-inline and margin-inline properties (similar to
Update: Here's a discussion for this topic: #13690 |
This PR introduces support for logical properties in the inline direction for all relevant existing utilities, making it easier to build sites that support LTR and RTL layouts without having to use the
rtl:
variant when you simply need to mirror the styles.start-*
inset-inline-start
left-*
end-*
inset-inline-end
right-*
ms-*
margin-inline-start
ml-*
me-*
margin-inline-end
mr-*
ps-*
padding-inline-start
pl-*
pe-*
padding-inline-end
pr-*
rounded-s-*
border-start-start-radius
border-end-start-radius
rounded-l-*
rounded-e-*
border-start-end-radius
border-end-end-radius
rounded-l-*
rounded-ss-*
border-start-start-radius
rounded-tl-*
rounded-se-*
border-start-end-radius
rounded-tr-*
rounded-ee-*
border-end-end-radius
rounded-br-*
rounded-es-*
border-end-start-radius
rounded-bl-*
border-s-*
border-inline-start-width
border-l-*
border-e-*
border-inline-end-width
border-r-*
border-s-*
border-inline-start-color
border-l-*
border-e-*
border-inline-end-color
border-r-*
scroll-ms-*
scroll-margin-inline-start
scroll-ml-*
scroll-me-*
scroll-margin-inline-end
scroll-mr-*
scroll-ps-*
scroll-padding-inline-start
scroll-pl-*
scroll-pe-*
scroll-padding-inline-end
scroll-pr-*
Considerations
This PR is limited to supporting the inline direction only, as supporting the block direction introduces potential naming collisions that make the API design more challenging, for example is
mb-2
formargin-bottom
ormargin-block
?After a bunch of research and talking to people in the community, I'm convinced that in practice supporting the block direction has far fewer benefits than supporting the inline direction, so I've opted to support just the inline direction for now to avoid being blocked on the API and get this feature shipped so people can start benefitting from it today. We can always introduce support for the block direction separately in the future — no need for them to be introduced together and slow down the process.
Right now we are using the shortest names possible like
ps-*
but if we eventually add block support and feel like that's too ambiguous, we can always support a more verbose version likep-is-*
so that the block direction equivalent can bep-bs-*
. My gut is that the block direction stuff will be needed so infrequently that simply making the block direction more verbose and keeping the inline ones terse is actually going to be the better trade-off though.This PR does not include support for the logical values of
clear
orfloat
, as browser support is currently poor. We can of course revisit this in the future and add them another day when support is better.