-
|
When building RTL applications (Arabic, etc.), there's a common UX pattern where technical input fields should remain left-to-right even in RTL mode:
According to RTL Styling:
// In an RTL context (Arabic)
<TextField>
<Label>البريد الإلكتروني</Label> {/* Right-aligned */}
<Input
type="email"
placeholder="أدخل البريد الإلكتروني" {/* Right-aligned */}
value="[email protected]" {/* Should stay left-aligned */}
/>
</TextField>Does React Spectrum or React Aria Components have built-in support for this pattern? If not:
Currently, we're manually doing: const { i18n } = useTranslation();
const isRTL = i18n.dir() === 'rtl';
<Input
type="email"
dir={isRTL ? 'ltr' : undefined}
style={isRTL ? { textAlign: 'left' } : undefined}
/>Would appreciate any guidance on the best practice here!
|
Beta Was this translation helpful? Give feedback.
Answered by
David0036
Nov 10, 2025
Replies: 1 comment 2 replies
-
|
Thanks for the very interesting discussion and link. I'm following up with our globalisation team because I do not know enough about the topic to make a recommendation yet. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @snowystinger, I can workaround with this way before (from your CodeSandbox). Thanks for support!