npm.io
0.4.3 • Published 7 years ago

react-swedish-personal-identity-number-input

Licence
MIT
Version
0.4.3
Deps
0
Size
16 kB
Vulns
0
Weekly
0
Stars
1

React Swedish personal identity number input

A higher order component for formatting values in input elements as Swedish personal identity numbers

Build Status NPM version

Install

$ npm install --save react-swedish-personal-identity-number-input

Usage

import React from 'react';
import { createSwedishPersonalIdentityNumberInput } from 'react-swedish-personal-identity-number-input';

const YourInputComponent = ({ innerRef, ...rest }) => {
  return <input ref={innerRef} {...rest} />;
}

const SwedishPersonalIdentityNumberInput = createSwedishPersonalIdentityNumberInput(YourInputComponent);

const Demo = () => {
  const [value, setValue] = React.useState();

  return <SwedishPersonalIdentityNumberInput value={value} onChange={setValue} />;
}

License

MIT Jonathan Svenheden