Material-ui: Better RTL support (specifically for Card Headers)

Created on 30 Jan 2019  路  5Comments  路  Source: mui-org/material-ui

It would be great if things that typically use margin-left or margin-right to provide correct spacing could instead be empty flex-items that take up the same amount of space. This would result in automatic RTL compatibility for CardHeaders.

An example use-case for visual aide:
image
image

Card question

All 5 comments

Are CardHeaders currently not supporting RTL or are you asking for RTL behavior without adding jss plugins?

Would be nice to have markup + css for the two approaches to properly judge them.

CardHeaders do _mostly_ support RTL (at least much better than the beta version, which we were using until recently). The second screenshot is using the out-of-the-box CardHeader component with the page direction switched to 'rtl'. The issue specifically is that the spacing around the avatar is hard-coded with margin-right, so does not adjust correctly when the page is flipped.
.MuiCardHeader-avatar-95 { flex: 0 0 auto; margin-right: 16px; }

I might not have dug far enough into the documentation, but is there a jss plugin I could use that would adjust these details like spacing for MaterialUI components automatically?

I haven't tested it, but I believe step 3 here will solve your issue: https://material-ui.com/guides/right-to-left/

Edit, actually, if you take a look at the demo here: https://material-ui.com/demos/cards/#complex-interaction and switch the docs to RTL:
image

it does appear to work correctly:

image

I agree with @mbrookes. It's very likely an issue with step 3 of the guide. @mmartha This should solve your problem :).

It did indeed, thank you for your help!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

finaiized picture finaiized  路  3Comments

TimoRuetten picture TimoRuetten  路  3Comments

rbozan picture rbozan  路  3Comments

ryanflorence picture ryanflorence  路  3Comments

ghost picture ghost  路  3Comments