Repository navigation
'direction' component found in docs but missing from registry #9622
Replies: 4 comments 1 reply
|
This looks like the direction component hasn't been published to the registry yet — the RTL docs reference it but the JSON doesn't exist at ui.shadcn.com/r/styles/new-york/direction.json. In the meantime, you can set up RTL support manually using Radix's Direction provider directly: import { DirectionProvider } from "@radix-ui/react-direction"; export default function App({ children }: { children: React.ReactNode }) { This is effectively what the shadcn direction component wraps — it just hasn't been added to the registry yet. You might want to open an issue to track it if one doesn't exist already. |
|
yeah this is a known doc/registry mismatch lol the quick workaround — do it manually: npm install @radix-ui/react-directionthen create "use client"
import { DirectionProvider as RadixDirectionProvider } from "@radix-ui/react-direction"
type Direction = "ltr" | "rtl"
function DirectionProvider({ children, direction }: { children: React.ReactNode; direction: Direction }) {
return (
<RadixDirectionProvider dir={direction}>
{children}
</RadixDirectionProvider>
)
}
export { DirectionProvider }then in ur <DirectionProvider direction="rtl">
{children}
</DirectionProvider>also add |
|
The component isn't missing everywhere, only from the
So you can install it straight from the v4 registry: npx shadcn@latest add https://ui.shadcn.com/r/styles/new-york-v4/direction.jsonIt imports from the unified import * as Direction from "@radix-ui/react-direction"Then wrap the app: import { DirectionProvider } from "@/components/ui/direction"
<html lang="ar" dir="rtl">
<body>
<DirectionProvider dir="rtl">{children}</DirectionProvider>
</body>
</html> |
|
The docs page is describing Radix's Direction primitive, not a shadcn registry component. There is no Install the Radix package and wrap the tree yourself: npm install @radix-ui/react-direction// app/layout.tsx (or your root provider)
import { DirectionProvider } from '@radix-ui/react-direction'
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="ar" dir="rtl">
<body>
<DirectionProvider dir="rtl">{children}</DirectionProvider>
</body>
</html>
)
}Two things that trip people up:
You do not need a shadcn wrapper for this. If the docs keep advertising If this unblocked the RTL setup, please mark this as the accepted answer so others hitting the 404 can find it. |
Uh oh!
There was an error while loading. Please reload this page.
The documentation for RTL support (https://ui.shadcn.com/docs/rtl) and the Direction component (https://ui.shadcn.com/docs/components/radix/direction) instructs users to install the direction provider using the CLI command: npx shadcn@latest add direction
However, running this command fails because the item does not exist in the registry.
All reactions