1.0.1 • Published 2 years ago

@jonnsl/react-currency-input v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React Currency Input

Demo

npm.io

Live Demo on CodePen

Installation

npm install --save @jonnsl/react-currency-input

Examples

import React, { useState } from "react";
import Money from "@jonnsl/react-currency-input";

function BRLInput (props) {
  const [value, setValue] = useState(0);

  return <Money prefix="R$" max={99999999} onChange={(v) => setValue(v)} value={value} />;
}

export default BRLInput;

Props

PropsOptionsDefaultDescription
prefixstringundefinedString to be added before the formatted number.
namestringundefinedAttribute name for the html input
classNamestringundefinedA string variable representing the class or space-separated classes of the current element.
idstringundefinedthe element's identifier
valuenumberundefinedInput value
defaultValuestrnumberingundefinedInitial value for the input when the component is first mounted.
readOnlybooleanundefinedindicates that the element is not editable, but is otherwise operable.
disabledbooleanundefinedelement is perceivable but disabled, so it is not editable or otherwise operable.
requiredbooleanundefinedindicates that user input is required on the element before a form may be submitted.
placeholderstringundefineddefines a short hint intended to aid the user with data entry when the control has no value.
maxnumberundefineddefines the maximum allowed value for the input.
styleCSSPropertiesundefinedCSS styling declarations to be applied to the input element.
tabIndexnumberundefinedindicates that its element can be focused, and where it participates in sequential keyboard navigation (usually with the Tab key, hence the name).
titlestringundefinedtext representing advisory information related to the element it belongs to.
onChange(newValue: number) => voidundefinedThe change event is fired when the user modifies the input's value.

License

This project is licensed under the MIT License - see LICENSE for details.