Skip to Content
Liquid Glass UI
Components

Direction

Provides right-to-left (RTL) text direction context for Arabic, Hebrew, and other RTL interfaces so Slider, Switch, and Base UI controls mirror automatically.

Fully compatible with the standard shadcn/ui API, re-exporting DirectionProvider and useDirection() directly from @base-ui/react. Wrapping a subtree with DirectionProvider (alongside matching dir="rtl" on the container) automatically mirrors Base UI interactions—such as Slider filling from the right and reversing arrow keys, and Switch flipping layout direction. Logical CSS properties (ms-*, me-*, start-*, end-*) are used throughout the library for accurate RTL alignment.

apple-liquid-ui/preview/direction-demo
MacBook · 16:10

Installation (Shadcn Registry)

npx shadcn@latest add @apple-liquid/direction

Usage

import { DirectionProvider } from '@/components/ui/direction';
import { Slider } from '@/components/ui/slider';

export function Example() {
  return (
    <DirectionProvider direction="rtl">
      <div dir="rtl">
        <Slider defaultValue={60} aria-label="المستوى" />
      </div>
    </DirectionProvider>
  );
}

Props API

DirectionProvider

PropTypeDefaultDescription
direction'ltr' | 'rtl''ltr'Text direction for the wrapped subtree

useDirection() returns the active direction for custom components.

On this page