UIs for languages that are read from right-to-left (RTL), such as Arabic and Hebrew, should be mirrored to ensure content is easy to understand.
Design & API Documentation
npm install --save @material/rtl
mdc-rtl is the most flexible mixin, because it can work with multiple CSS properties. All other RTL mixins logic could be engineered by only using
mdc-rtl, but we provide these mixins for convenience.
mdc-rtl-reflexive-box work with one base box-model property, e.g. margin, border, padding. But
mdc-rtl-reflexive-property is more flexible because it accepts different left and right values.
mdc-rtl-reflexive-box assumes the left and right values are the same, and therefore that the box-model is symmetrical.
mdc-rtl-reflexive-position is the least flexible mixin. It only works with one horizontal position property, “left” or “right”. It also assumes the left and right values are the same.
||Creates a rule that is applied when the root element is within an RTL context|
||Applies the value to the
||Emits rules that assign
||Applies the value to the specified position in a LTR context, and flips the direction in an RTL context.
A note about [dir=”rtl”]:
mdc-rtl($root-selector) checks for
[dir="rtl"] on the ancestor element. This works in most cases, it will sometimes lead to false negatives for more complex layouts, e.g.
<html dir="rtl"> <!-- ... --> <div dir="ltr"> <div class="mdc-foo">Styled incorrectly as RTL!</div> </div> </html>
Unfortunately, we’ve found that this is the best we can do for now. In the future, selectors such as :dir will help us mitigate this.