Skip to content

RTL

Components use logical CSS classes, so a right-to-left document mirrors them with no transform.

Logical classes

Components use logical CSS properties, such as ms-1, rounded-s-md, and border-e. Start and end follow the text direction of the element, so a right-to-left document mirrors each component with no transform. Set dir="rtl" on <html> or on a container.

React Aria gets the keyboard direction from the locale, not from dir. For arrow keys in sliders, tabs, and toolbars, set a right-to-left locale with I18nProvider. See Internationalization.

The CLI rtl option

With rtl: true in components.json, or --rtl on shadcn init (opens in a new tab), the CLI changes physical classes to logical ones at install time. vip/ui files already use logical classes, so the CLI installs them with no change.

Physical classes

ItemHighlight, Slider, RangeCalendar, BorderBeam, and Highlighter set left or right on purpose. They measure pixel offsets to move a layer over an item, so the layer anchors to one physical edge.

Do not migrate the vip/ui files

shadcn migrate rtl rewrites left and right classes in your ui directory, including components/vip-ui. In these five components, the layers then move away from their items. Run the migration on shadcn/ui files only.