{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"direction","type":"registry:ui","title":"Direction","description":"Sets reading direction for everything inside it. Spacing, borders, affixes and the selected edge follow on their own; icons that point somewhere flip when marked.","dependencies":[],"registryDependencies":["https://caliperui.site/r/styles.json"],"files":[{"path":"ui/direction.tsx","type":"registry:ui","target":"components/ui/direction.tsx","content":"\"use client\";\n\nimport { createContext, useContext, type ComponentProps } from \"react\";\nimport \"./direction.css\";\n\nexport type TextDirection = \"ltr\" | \"rtl\";\n\nconst DirectionContext = createContext<TextDirection>(\"ltr\");\n\nexport type DirectionProps = Omit<ComponentProps<\"div\">, \"dir\"> & { dir: TextDirection };\n\n/**\n * Sets the reading direction for everything inside it. Parts use logical properties and\n * `:dir()` rules, so spacing, borders and affixes follow on their own; mark an icon that\n * points somewhere with `data-mirror` and it flips too. The wrapper adds no box of its own.\n * Overlays render in a portal outside it, so they read the direction with `useDirection`.\n */\nexport function Direction({ dir, children, ...props }: DirectionProps) {\n  return (\n    <DirectionContext.Provider value={dir}>\n      <div data-slot=\"direction\" dir={dir} {...props}>\n        {children}\n      </div>\n    </DirectionContext.Provider>\n  );\n}\n\n/** The direction set by the nearest Direction, \"ltr\" outside one. */\nexport function useDirection(): TextDirection {\n  return useContext(DirectionContext);\n}\n"},{"path":"ui/direction.css","type":"registry:file","target":"components/ui/direction.css","content":"/* direction.tsx's styles; it imports this file. Edit freely. */\n@layer theme, base, components, utilities;\n\n@layer components {\n  /* Direction: no box of its own, and a mark for icons that point somewhere. */\n  [data-slot=\"direction\"] { display: contents; }\n  :dir(rtl) > [data-mirror], [data-mirror]:dir(rtl) { scale: -1 1; }\n}\n"}],"categories":["navigation"],"meta":{"tier":"free","license":"MIT","family":"theme","docs":"/docs/components/direction"}}