HextaUI

Number input (UI SDK): Right to left

The buttons swap sides, and the locale sets the digits and the currency.

import { Label } from "@/components/ui/label"
import {
  NumberInput,
  NumberInputControl,
  NumberInputDecrement,
  NumberInputGroup,
  NumberInputIncrement,
} from "@/components/ui/ui-sdk-number-input"

function UiSdkNumberInputRtl() {
  return (
    <div dir="rtl" className="flex w-full max-w-44 flex-col gap-2">
      <Label htmlFor="rtl-amount">المبلغ</Label>
      <NumberInput
        defaultValue={250}
        min={0}
        step={5}
        locale="ar-EG"
        format={{ style: "currency", currency: "EGP" }}
      >
        <NumberInputGroup>
          <NumberInputDecrement aria-label="إنقاص" />
          <NumberInputControl id="rtl-amount" />
          <NumberInputIncrement aria-label="زيادة" />
        </NumberInputGroup>
      </NumberInput>
    </div>
  )
}

export { UiSdkNumberInputRtl }

This adds the example as components/examples/ui-sdk-number-input/rtl.tsx, together with the Number input component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/ui-sdk-number-input-rtl.json

To add only the component, follow the Number input installation.

Props in this example

The Number input props this example sets, from the API reference.

PropTypeDefault
defaultValue
number | null–
min
number–
step
number1
format
Intl.NumberFormatOptions–
localeDefaults to the page’s language.
string–
PropTypeDefault
id
string–
PropTypeDefault
aria-label
string"Increase"
PropTypeDefault
aria-label
string"Decrease"

Every prop is in the Number input API reference.

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