Skip to content

Latest commit

 

History

History
77 lines (51 loc) · 1.62 KB

formatted-input.md

File metadata and controls

77 lines (51 loc) · 1.62 KB

FormattedInput

Source

A text input that automatically formats its input with a formatter. Since this component is based on the Input-component, it takes any of the Input-components props, which are not listed here.

This component only works as an uncontrolled component, meaning that it does not take a value-prop.

Usage

You should have the chayns-components package installed. If that is not the case already, run

yarn add chayns-components

or

npm i chayns-components

After the chayns-components package is installed, you can import the component and use it with React:

import React from 'react'
import { FormattedInput } from 'chayns-components';

// ...

<FormattedInput {...} />

Props

The FormattedInput-component takes the following props:

Name Type Default Required
initialFormatter Formatter
onChange function
defaultValue any

initialFormatter

initialFormatter: Formatter;

An instance of a formatter that will be used to format the value of the input.


onChange

onChange?: function

The function that will be called on change.


defaultValue

defaultValue?: any

The initial value of the input.