All Projects → renato-bohler → Redux Form Input Masks

renato-bohler / Redux Form Input Masks

Licence: mit
Input masking with redux-form made easy

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Redux Form Input Masks

redux-crud-example
Basic crud react-redux-featherjs app for managing contacts
Stars: ✭ 54 (-59.7%)
Mutual labels:  redux-form
Revalidate
Elegant and composable validations
Stars: ✭ 363 (+170.9%)
Mutual labels:  redux-form
Hapi React Hot Loader Example
Simple React Hot Loading example with Hapi Server-side rendering
Stars: ✭ 44 (-67.16%)
Mutual labels:  redux-form
react-login-registration
An example React / Redux / Redux Saga application talking to a Symfony 3 API
Stars: ✭ 31 (-76.87%)
Mutual labels:  redux-form
inventory-demo
a simple MERN stack CRUD app example
Stars: ✭ 15 (-88.81%)
Mutual labels:  redux-form
React With Redux Shop Ducks
shopping cart example with react and redux
Stars: ✭ 12 (-91.04%)
Mutual labels:  redux-form
validarium
🛡Agnostic validation library for JavaScript applications.
Stars: ✭ 29 (-78.36%)
Mutual labels:  redux-form
Redux Autoform
Create Redux-Forms dynamically out of metadata
Stars: ✭ 113 (-15.67%)
Mutual labels:  redux-form
Jackblog React
Jackblog react 版, 个人博客系统, 使用服务端渲染(Universal / Isomorphic), react, redux, react-router, react-bootstrap, immutablejs, redux-form等
Stars: ✭ 292 (+117.91%)
Mutual labels:  redux-form
Typescript Hapi React Hot Loader Example
Simple TypeScript React Hot Loading example with Hapi Server-side rendering
Stars: ✭ 44 (-67.16%)
Mutual labels:  redux-form
redux-form-jsonschema-reactstrap
redux-form field library using reactstrap
Stars: ✭ 19 (-85.82%)
Mutual labels:  redux-form
boss-lite
Boss Lite - React Redux Material Admin Template
Stars: ✭ 148 (+10.45%)
Mutual labels:  redux-form
Redux Forms Example Weather
Example project using redux-form and redux-saga
Stars: ✭ 37 (-72.39%)
Mutual labels:  redux-form
react-phoenix-users-boilerplate
Elixir/Phoenix + React + users template/boilerplate.
Stars: ✭ 71 (-47.01%)
Mutual labels:  redux-form
Apollo Redux Form
Redux forms powered by Apollo
Stars: ✭ 52 (-61.19%)
Mutual labels:  redux-form
alda
A boilerplate for React isomorphic aplication with Material Design
Stars: ✭ 16 (-88.06%)
Mutual labels:  redux-form
React Native Clean Form
Easy react-native forms using bootstrap-like syntax with redux-form+immutablejs integration. Styled using styled-components
Stars: ✭ 468 (+249.25%)
Mutual labels:  redux-form
React Controlled Form
Flexible, Modular & Controlled Forms for React and Redux
Stars: ✭ 121 (-9.7%)
Mutual labels:  redux-form
Reactjs Crud Boilerplate
Live Demo
Stars: ✭ 83 (-38.06%)
Mutual labels:  redux-form
Push Starter
React Redux Starter with SSR 🤖
Stars: ✭ 43 (-67.91%)
Mutual labels:  redux-form

redux-form-input-masks

travis ci build status percentage of code coverage by tests latest release code style: prettier commitizen friendly semantic release license MIT

Documentation and examples

Migration guide

Getting started

redux-form-input-masks is a library that works with redux-form to easily add masking to Fields.

Example GIF

Motivation

Redux is awesome and so are input masks: they help standardizing inputs and improves the UX of the application. redux-form has support for input formatting, parseing and normalizing, but it can get pretty tricky to implement a mask with these functions. redux-form-input-masks offer simple APIs to create these masks so you don't need to worry about it!

Also, the value of the Fields in any application should be agnostic of how the Fields themselves are presented to the user. For example, if there's a currency field in a form, it makes more sense to store the value as a number. Storing Field values in a way that makes more sense for the application makes it easier to integrate form data with backend services and to create validations for it. With redux-form-input-masks you can also choose how the value of a formatted Field will be stored in the application's store.

Under the hood

redux-form-input-masks returns objects implementing redux-form's Value Lifecycle Hooks and also some Global Event Handlers to manage the caret position.

Installation

npm install --save redux-form-input-masks

or

yarn add redux-form-input-masks

Features

  • simple to setup: works with redux-form out of the box, you just need to install redux-form-input-masks and you're good to go;
  • simple to use: import a mask creator and apply it... and that's it. There's no need to change the component you're already using;
  • flexible: lets you choose how you want the input mask to behave;
  • dependency compatible: redux-form-input-masks works with basically all combinations of versions of react, react-dom, react-redux, redux and redux-form;
  • browser compatible: works on all major browsers (Chrome, Firefox, Safari, Edge, Opera, Opera Mini and Internet Explorer >= 10);
  • lightweight: not a single dependency is added to redux-form-input-masks;
  • compatible with component libraries like material-ui and redux-form-material-ui's wrappers, for both v0-stable and v1-beta versions.

Available masks

Name Description API Reference Demo
Number Mask Ideal for currency, percentage or any other numeric input. Supports prefix, suffix, locale number formatting and even more options. You can also choose wether the value is stored as number or string. createNumberMask codesandbox.io
Text Mask Flexible string mask. Lets you specify the pattern, inputtable characters and much more. createTextMask codesandbox.io

Usage

It's super simple to apply a mask using this library. You just need to import your mask creator from redux-form-input-masks, specify the parameters and pass it to the Field using spread attributes. Yep, it's that easy.

You can find several examples including demos on our documentation.

Here's a simple snippet that uses createNumberMask and createTextMask and applies them to Fields:

import { createNumberMask, createTextMask } from 'redux-form-input-masks';

(...)

const currencyMask = createNumberMask({
  prefix: 'US$ ',
  suffix: ' per item',
  decimalPlaces: 2,
  locale: 'en-US',
})

const phoneMask = createTextMask({
  pattern: '(999) 999-9999',
});

(...)

<Field
  name="amount"
  component="input"
  type="tel"
  {...currencyMask}
/>

<Field
  name="phone"
  component="input"
  type="tel"
  {...phoneMask}
/>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].