Skip to content
العربية
Saudi forms and dates

MoneyInput

An amount in riyals with the Riyal sign on the left. Arabic digits and separators become Western.

import { MoneyInput, parseAmount } from "@percentsa/ui";

Examples

Arabic digits work too

parseAmount: null

Code
export function MoneyInputExample() {
  const t = useT();
  const [amount, setAmount] = useState("");
  return (
    <Stack gap={3} className="w-full max-w-xs">
      <Field label={t("Budget", "الميزانية")} hint={t("Arabic digits work too", "تعمل الأرقام العربية أيضًا")}>
        <MoneyInput value={amount} onValueChange={setAmount} />
      </Field>
      <Text size="sm" tone="subtle">parseAmount: {String(parseAmount(amount))}</Text>
    </Stack>
  );
}