Faber UI
Components

Direction

A re-export of the Base UI direction provider for RTL and LTR layouts.

Direction is a thin re-export of the Base UI direction provider. It sets the text direction (LTR or RTL) for a subtree and exposes a useDirection hook to read the current value.

Installation

Terminal
pnpm dlx shadcn@latest add https://faber-ui.vercel.app/r/direction.json

Usage

typescript
"use client";

import {
  DirectionProvider,
  useDirection,
} from "@/components/ui/direction";

export default function Example() {
  return (
    <DirectionProvider dir="rtl">
      <Content />
    </DirectionProvider>
  );
}

function Content() {
  const direction = useDirection();
  return <p>Current direction: {direction}</p>;
}

API

Each part forwards every prop of what it is built on, including className and render where Base UI supports it. The props column lists only what Faber UI adds on top.

PartBuilt onProps
DirectionProviderDirectionProviderBase UIโ€”
useDirectionuseDirectionHook ยท Base UIโ€”

Last updated on

On this page