radix-ui / themes

Radix Themes is an open-source component library optimized for fast development, easy maintenance, and accessibility. Maintained by @workos.
https://radix-ui.com/themes
MIT License
5.73k stars 205 forks source link

RTL support #11

Open meerns opened 1 year ago

meerns commented 1 year ago

First of all thanks for this amazing library, I can't stop using it its so good! I was just wondering if there's any plan to support RTL. I tried the DirectionProvider and it doesn't work.

'use client'

import { DirectionProvider } from '@radix-ui/react-direction'

type Props = {
  children: React.ReactNode
}

const Direction = (props: Props) => {
  return <DirectionProvider dir='rtl'>{props.children}</DirectionProvider>
}

export default Direction

Thanks!

jd-carroll commented 1 year ago

Just as an FYI, it technically already "supports" rtl there is just no way to change the current ltr to rtl.

Here is the relevant code: https://github.com/radix-ui/themes/blob/39f5a438db0d8496134d4bc35d71899fee1b2562/packages/radix-ui-themes/src/theme.tsx#L41-L47

You could maybe propose something that moves the <DirectionProvider> into the ThemeRoot component and then create a new style script which sets the direction similar to how the theme is handled: https://github.com/radix-ui/themes/blob/39f5a438db0d8496134d4bc35d71899fee1b2562/packages/radix-ui-themes/src/theme.tsx#L106-L114

andy-hook commented 1 year ago

There is some additional complexity for supporting logical css properties which is why this didn't make it into the initial release, we do plan to add support though.

seb-lean commented 1 week ago

@andy-hook @vladmoroz FWIW it's somewhat confusing and unclear that the primitives highlight RTL support, but the Theme doesn't. I think most most people would assume that when considering Radix as a component library. Is adding RTL support on the roadmap?