HextaUI

Field: Right to left

Text, checkbox placement and error lists follow the reading direction.

سنرسل رابط التأكيد إلى هذا العنوان.

أدخل عنوان بريد صالحًا.
import { Checkbox } from "@/components/ui/checkbox"
import {
  Field,
  FieldDescription,
  FieldError,
  FieldGroup,
  FieldLabel,
} from "@/components/ui/field"
import { Input } from "@/components/ui/input"

export function FieldRtl() {
  return (
    <div dir="rtl" className="w-full max-w-sm">
      <FieldGroup>
        <Field invalid>
          <FieldLabel>البريد الإلكتروني</FieldLabel>
          <Input type="email" defaultValue="ada@" />
          <FieldDescription>
            سنرسل رابط التأكيد إلى هذا العنوان.
          </FieldDescription>
          <FieldError errors={[{ message: "أدخل عنوان بريد صالحًا." }]} />
        </Field>
        <Field orientation="horizontal">
          <Checkbox defaultChecked />
          <FieldLabel>تذكرني</FieldLabel>
        </Field>
      </FieldGroup>
    </div>
  )
}

This adds the example as components/examples/field/rtl.tsx, together with the Field component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/field-rtl.json

To add only the component, follow the Field installation.

Props in this example

The Field props this example sets, from the API reference.

PropTypeDefault
orientation
"vertical" | "horizontal" | "responsive""vertical"
invalidSet it from a form library or server response.
boolean–
PropTypeDefault
errorsErrors from a form library or server. Shown when the list has a message.
Array<{ message?: string } | undefined>–

Every prop is in the Field API reference.

See them all, with keyboard support and accessibility notes, on the Field page.