Skip to content

react-use-locale-number-input is a React hook that formats and parses number inputs based on the provided locale.

License

Notifications You must be signed in to change notification settings

joswide/react-use-locale-number-input

Repository files navigation

Node.js CI npm version

react-use-locale-number-input

Description

react-use-locale-number-input is a React hook that formats and parses number inputs based on the provided locale.

Example

import React from "react";
import { useLocaleNumberInput } from "react-use-locale-number-input";

function ControlledInput() {
  const [value, onChange] = React.useState("10000");

  const {
    value: displayValue,
    handleBlur,
    handleChange,
  } = useLocaleNumberInput(value, "de-DE", onChange);

  return (
    <input onBlur={handleBlur} value={displayValue} onChange={handleChange} />
  );
}

Tests

npm run test

Docs

See https://joswide.com for more details

About

react-use-locale-number-input is a React hook that formats and parses number inputs based on the provided locale.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published