1.3.1 • Published 4 years ago

@opuscapita/react-formatted-input v1.3.1

Weekly downloads
19
License
MIT
Repository
github
Last release
4 years ago

react-formatted-input

Description

Describe the component here

Installation

npm install @opuscapita/react-formatted-input

Demo

View the DEMO

Change log

View the Change log

Migrate guide

View the Migrate guide between major versions

Builds

UMD

The default build with compiled styles in the .js file. Also minified version available in the lib/umd directory.

CommonJS/ES Module

You need to configure your module loader to use cjs or es fields of the package.json to use these module types. Also you need to configure sass loader, since all the styles are in sass format.

FormattedInput API

Prop nameTypeDefaultDescription
onChangefuncRequiredCalled upon change
onBlurfuncNoop functionCalled upon blur
onMouseDownfuncNoop functionCalled upon mouse down
formatterfuncNoop functionFunction that formats the value on blur
editFormatterfuncNoop functionFunction that formats the value on change
inputPropsobjectCollection of props that are be passed to the input field
valuetext, numberInput value

FormattedInputCurrency API

Prop nameTypeDefaultDescription
onChangefuncRequiredCalled upon change
onBlurfuncNoop functionCalled upon blur
currencystringundefinedCurrency code to get number of decimals from
decimalsstringundefinedNumber of decimals, overrides currency decimals
thousandSeparatorstringundefinedThousand separator
decimalSeparatorstring"."Decimal separator
selectValueOnClickboolfalseIf true, input value is selected on click

Code example

import React from 'react';
import FormattedInput, { FormatInputCurrency } from '@opuscapita/react-formatted-input';

export default class ReactView extends React.Component {
  formatter = (value) => `formatted-${value}`;

  render() {
    return (
      <React.Fragment>
      <FormattedInput
        onChange="..."
        formatter={this.formatter}
      />
      <FormattedInputCurrency
        currency="EUR"
        onChange="..."
      />
      <React.Fragment>
    );
  }
}
1.3.1

4 years ago

1.3.0

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago