JSPM

react-simple-cep-mask

0.1.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 325
  • Score
    100M100P100Q98111F
  • License MIT

Simple input mask for brazilian zipcode.

Package Exports

  • react-simple-cep-mask

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-simple-cep-mask) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

React simple input mask for brazilian zipcode format.

Simple <input /> wrapper to mask the value with a BR zipcode mask.
It will apply all the props given to it, to an input field, enabling any customization.

Componente para adicionar máscara de cep sem dependências. Os props são copiados diretamente para um <input />, permitindo customização.

ttystrudio GIF

Installation

$ yarn add react-simple-cep-mask

Example

Basic Example

import React, { useState } from "react";
import ReactDOM from "react-dom";
import Cep from "react-simple-cep-mask";

const App = () => {
  const [cep, setCep] = useState("");
  return (
    <>
      <h2>Basic example</h2>
      <br />

      <Cep
        value={cep}
        onChange={ (cep) => setCep(cep) } 
      />

      <br />
      <h4>Masked value: {cep}</h4>
    </>
  );
};

ReactDOM.render(<App />, document.getElementById("root"));

With custom props

import React, { useState } from "react";
import ReactDOM from "react-dom";
import Cep from "react-simple-cep-mask";

const App = () => {
  const [cep, setCep] = useState("");
  return (
    <>
      <h2>With custom props</h2>
      <br />

      <Cep
        value={cep}
        onChange={ (cep) => setCep(cep) }
        className="someClass"
        placeholder="Digite seu cep"
       />

      <br />
      <h4>Masked value: {cep}</h4>
    </>
  );
};

ReactDOM.render(<App />, document.getElementById("root"));

License

License