Direction-aware spacing (LTR/RTL) in v5
See original GitHub issueIt’s more a question, as I couldn’t find any indication of it in current documentation for v5. Is there any plan to support text direction aware spacing utilities? It would simplify cases where an element has assymmetrical X padding/margin. At the moment, the only option I can think of is something like the following:
<Box sx={{
ml: (theme) => (theme.direction === 'rtl' ? .5 : 1),
mr: (theme) => (theme.direction === 'rtl' ? 1 : .5)
}}>
...
</Box>
Is there a better alternative than the above? If not, what about direction-aware spacing utilities instead, e.g. (ms
: margin start, me
: margin end):
<Box sx={{ ms: 1, me: .5 }}>...</Box>
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Direction-aware spacing (LTR/RTL) in v5 #24270 - GitHub
Yes, I figured. It looks like emotion does not have the same dynamic as JSS, and requires to use 2 caches created statically....
Read more >Right-to-left Styling - RTL Styling 101
Below is a basic example to show the difference between an LTR and an RTL layout. ... However, if the same letter-spacing style...
Read more >Material-Ui Textfield Not Affected With The Rtl Direction
The best support for React 17 will be found in Material-UI v5. ... Is there any plan to support text direction aware spacing...
Read more >direction - CSS: Cascading Style Sheets - MDN Web Docs
The direction CSS property sets the direction of text, table columns, and horizontal overflow. Use rtl for languages written from right to ...
Read more >Structural markup and right-to-left text in HTML - W3C
You must always declare the directionality using the dir attribute. Scroll bars. The LTR/RTL direction of the page shouldn't affect the location ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Correct, it has changed since the last time we wrote this documentation. sc needs v1 when emotion needs v2. For sc, we need to wait for v6 https://github.com/styled-components/styled-components/issues/3060. We should probably update the docs.
@mnajdova I recall you mentioned that the plugin has issues. Is this one you have identified? @goffioul Maybe we should report it to the plugin’s author?
Is there anything else to do to on this issue? Can we close it? We have updated https://next--material-ui.netlify.app/guides/right-to-left/#3-install-the-rtl-plugin.