All Projects β†’ Awesome-React-Modules β†’ React-Pincode

Awesome-React-Modules / React-Pincode

Licence: other
A NPM module which auto fills City, District and State fields when a valid Zip Code in entered!

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects
shell
77523 projects

Projects that are alternatives of or similar to React-Pincode

Jsonexport
{} β†’ πŸ“„ it's easy to convert JSON to CSV
Stars: ✭ 208 (+700%)
Mutual labels:  npm-package, npm-module
Singlespotify
🎡 Create Spotify playlists based on one artist through the command line
Stars: ✭ 254 (+876.92%)
Mutual labels:  npm-package, npm-module
Abort Controller
An implementation of WHATWG AbortController interface.
Stars: ✭ 213 (+719.23%)
Mutual labels:  npm-package, npm-module
Reactopt
A CLI React performance optimization tool that identifies potential unnecessary re-rendering
Stars: ✭ 1,975 (+7496.15%)
Mutual labels:  npm-package, npm-module
MinifyAllCli
πŸ“¦ A lightweight, simple and easy npm tool to π—Ίπ—Άπ—»π—Άπ—³π˜† JSON/C, HTML and CSS! Also known as MinifyAll core! ⭐ Usable as π‘ͺ𝑳𝑰 tool or π’Šπ’Žπ’‘π’π’“π’•π’‚π’ƒπ’π’† in TS/JS as a 𝑴𝑢𝑫𝑼𝑳𝑬 πŸ₯°
Stars: ✭ 21 (-19.23%)
Mutual labels:  npm-package, npm-module
Node Regedit
Read, Write, List and do all sorts of funky stuff to the windows registry using node.js and windows script host
Stars: ✭ 178 (+584.62%)
Mutual labels:  npm-package, npm-module
Ts ci
βœ… Continuous integration setup for TypeScript projects via GitHub Actions.
Stars: ✭ 225 (+765.38%)
Mutual labels:  npm-package, npm-module
Event Target Shim
An implementation of WHATWG EventTarget interface, plus few extensions.
Stars: ✭ 89 (+242.31%)
Mutual labels:  npm-package, npm-module
arcscord
A Discord library written in typescript
Stars: ✭ 18 (-30.77%)
Mutual labels:  npm-package, npm-module
intersection-wasm
Mesh-Mesh and Triangle-Triangle Intersection tests based on the algorithm by Tomas Akenine-MΓΆller
Stars: ✭ 17 (-34.62%)
Mutual labels:  npm-package, npm-module
Homebridge Wol
A Wake on Lan plugin for Homebridge
Stars: ✭ 150 (+476.92%)
Mutual labels:  npm-package, npm-module
react-folder-tree
A versatile react treeview library that supports custom icons and event handlers
Stars: ✭ 56 (+115.38%)
Mutual labels:  npm-package, npm-module
React Ckeditor
CKEditor component for React with plugin and custom event listeners support
Stars: ✭ 124 (+376.92%)
Mutual labels:  npm-package, npm-module
Darkmode.js
πŸŒ“ Add a dark-mode / night-mode to your website in a few seconds
Stars: ✭ 2,339 (+8896.15%)
Mutual labels:  npm-package, npm-module
Tplink Cloud Api
A node.js npm module to remotely control TP-Link smartplugs (HS100, HS110) and smartbulbs (LB100, LB110, LB120, LB130) using their cloud web service (no need to be on the same wifi/lan)
Stars: ✭ 96 (+269.23%)
Mutual labels:  npm-package, npm-module
Eslint Plugin Eslint Comments
Additional ESLint rules for directive comments of ESLint.
Stars: ✭ 221 (+750%)
Mutual labels:  npm-package, npm-module
Node Loadbalance
A collection of distilled load balancing engines
Stars: ✭ 79 (+203.85%)
Mutual labels:  npm-package, npm-module
Forge Node App
πŸ› πŸ“¦πŸŽ‰ Generate Node.js boilerplate with optional libraries & tools
Stars: ✭ 90 (+246.15%)
Mutual labels:  npm-package, npm-module
js-stack-from-scratch
🌺 Russian translation of "JavaScript Stack from Scratch" from the React-Theming developers https://github.com/sm-react/react-theming
Stars: ✭ 394 (+1415.38%)
Mutual labels:  npm-package, npm-module
micro-signals
A tiny typed messaging system inspired by js-signals that uses ES2015 sets
Stars: ✭ 39 (+50%)
Mutual labels:  npm-package, npm-module

React Pincode

React Pincode is a published NPM module that can be integrated inside any ReactJS application. It is used to extract Area, City, District, and State information as soon as the user enters valid Pin-Code. On entering a valid Pin-Code, a GET request is made to the Indian Postal Service API and the useful information is extracted and results are displayed in the respective fields. If an invalid Pincode is entered an error is thrown which can be customized by a user using a specific prop.

Table of Contents

About

The four input fields are wrapped inside an <div> element and each input field is also wrapped inside <div>. So that a user can style it according to the need in the project.

Whenever the wrong Pincode is entered red border appears on the pin code input field and on entering a right pin code, city, district and state input fields get automatically filled with correct data

Note

This will only work for Indian Pincodes.

Working

import Pincode from 'react-pincode';

JS

import React, { useState, useEffect } from 'react';
import Pincode from 'react-pincode';

function App() {
  const [pincodeData, setPincodeData] = useState('');
  return (
    <div className="App">
      <Pincode
        invalidError="Please check pincode"
        lengthError="check length"
        getData={(data) => setPincodeData(data)}
      />
    </div>
  );
}

Playground

Find Codepen Implementation of the module here

Pincode Props

  1. Props for changing CSS properties
Name Description
Container Container which wraps all the three Input Field
pincodeContainer Container which wraps pincode Input Field
cityContainer Container which wraps City Input Field
districtContainer Container which wraps District Input Field
stateContainer Container which wraps State Input Field
pincodeInput Props for styling pincode input field
cityInput Props for styling city input field
stateInput Props for styling state input field
showArea Props for displaying Area input (default: true)
showState Props for displaying State input (default: true)
showDistrict Props for displaying District input (default: true)
showCity Props for displaying City input (default: true)
  1. Props for changing error message.

By deafult,

  • For an Invalid Pincode - "Invalid PIN Code"
  • If Pincode length is not valid - "ZIP code must be of 6 digits"
Name Description
invalidError Props for changing invalid error message.
lenghtError Props for changing invalid length message.

Example

JS

import React, { Component } from 'react';
import Pincode from "react-pincode";

export default class Example extends Component {
  render() {
    return (
      <div>
        <Pincode  cityInput={{width:'200px'}}/>
        // This will set the length of city input field to 200px. You can play with rest of the props to style it according to your need.
      </div>
    )
  }
}
export default Example;

Development and Testing

  1. Set-up the React-Pincode module by dowloading its dependencies, using npm install command.
  2. Build the module using npm run build
  3. Link the module for testing using npm link command.
  4. Change your directory to test-server directory, using cd test-server
  5. Install the dependecies using npm install
  6. Now run npm link react-pincode
  7. Congratulations! You have set-up the test server for react-pincode. Now just run npm start from test-server directory to launch the test-server.
  8. You don't need to stop this server, the changes made in the module will be reflected automatically each time you build them using npm run build
  9. To watch a video on installation (Click on the thumbnail): Watch the video

Contributing

Please read Contributing Guidelines for information on how to contribute to React-Pincode.

Development Guidelines

  1. Write clean and readable code with proper formatting.
  2. Create a branch and push your code in the branch.
  3. Please follow PR template to create one.
  4. Please read our Code of Conduct .

Owner

Apoorv Taneja

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].