Getting Started
{
"$schema": "https://ui.shadcn.com/schema.json",
"rtl": true,
"style": "new-york",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "",
"css": "src/app/globals.css",
"baseColor": "zinc",
"cssVariables": true
},
"iconLibrary": "lucide",
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
}
}
How it works
When you add components withrtl: true set in your components.json, the shadcn CLI automatically transforms classes and props to be RTL compatible:
- Physical positioning classes like
left-*andright-*are converted to logical equivalents likestart-*andend-*. - Directional props are updated to use logical values.
- Text alignment and spacing classes are adjusted accordingly.
- Supported icons are automatically flipped using
rtl:rotate-180.
Supported Styles
Automatic RTL transformation via the CLI is only available for projects created usingshadcn create with the new styles (base-nova, radix-nova, etc.).
For other styles, see the Migration Guide.
Font Recommendations
For the best RTL experience, we recommend using fonts that have proper support for your target language. Noto is a great font family for this and it pairs well with Inter and Geist.Animations
The CLI also handles animation classes, automatically transforming physical directional animations to their logical equivalents. For example,slide-in-from-right becomes slide-in-from-end.
This ensures animations like dropdowns, popovers, and tooltips animate in the correct direction based on the document’s text direction.
There is a known issue with the
tw-animate-css library where the logical slide utilities are not working as expected. For now, make sure you pass in the dir prop to portal elements.showLineNumbers
showLineNumbers
Migrating existing components
If you have existing components installed before enabling RTL, you can migrate them using the CLI as follows:[path] accepts a path or glob pattern to migrate. If you don’t provide a path, it will migrate all the files in the ui directory.The following components are not automatically migrated by the CLI. Follow the RTL support section for each component to manually migrate them.
Some icons like
ArrowRightIcon or ChevronLeftIcon might need the rtl:rotate-180 class to be flipped correctly. Add the rtl:rotate-180 class to the icon component to flip it correctly.