Right-to-left (RTL) support for shadcncraft blocks
Pro blocks, components and patterns support right-to-left layouts. They use logical classes such as ms-2, ps-4 and border-s instead of left and right, so the same code mirrors correctly for Arabic, Hebrew, Persian and Urdu. Nothing changes for left-to-right projects.
Set up your project
You need all three steps. Each one covers a different part of the layout.
1. Turn on RTL in components.json
Set rtl to true. The shadcn CLI then converts shadcn's own primitives to logical classes when it installs them, so they match the Pro blocks.
{
"rtl": true
}2. Add a DirectionProvider
Add shadcn's direction component and wrap your app in it. Without the provider, Radix Tabs, Accordion, NavigationMenu and ScrollArea stay left to right, and sidebars open on the wrong side.
$ pnpm dlx shadcn@latest add direction
import { DirectionProvider } from "@/components/ui/direction";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="ar" dir="rtl">
<body>
<DirectionProvider dir="rtl">{children}</DirectionProvider>
</body>
</html>
);
}3. Set lang and dir on html
Set both lang and dir on the <html> element, as in the example above. Tailwind 4 compiles its rtl: and ltr: variants to language checks, so dir on its own is not enough.
Update existing installs
Blocks you installed before RTL support still use left and right classes. Add them again to pick up the changes:
$ pnpm dlx shadcn@latest add @shadcncraft/table-2 --overwrite
Review the diff before you commit if you have edited the block.
What flips
- Spacing, positioning, borders, radii, edge fades and shadows.
- Directional icons such as chevrons and arrows.
- Sidebars, which open from the right.
- Data grid column pinning and keyboard navigation.
- Gantt timelines, including dragging bars.
- Carousels.
What stays left to right
- Signed amounts, phone numbers, account and card numbers. They are isolated so they read correctly inside right-to-left text.
- Phone, email, URL and card inputs.
- Charts and code samples, by design.
- Maps.
Known limits
- Animated headings that split English copy into one span per word read in reverse order inside a right-to-left page. Arabic and Hebrew copy reads correctly.
- A few marketing heroes keep their artwork on the same side while the text mirrors.
- Quantity steppers, time ranges and ratings mirror, which is what right-to-left readers expect.
