shirinapr / iran-province

Iran Provinces react component

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iran-province

A customizable select, which has all the provinces in Iran.

Installation

npm i iran-province

Usage

import IranProvince from 'iran-province';

const App = () => (
  <>
    <IranProvince
      onChange={(province) => {
        console.log(province);
      }}
    />
    ;
  </>
);

export default App;

Props

Common props you may want to specify include:

  • label - apply name to the select
  • disabled - handle if it should be disabled
  • labelClass - apply a className to the label
  • autoFocus - focus the control when it mounts
  • selectClass - apply a className to the select
  • optionClass - apply a className to the options
  • className - apply a className to the container
  • language - you can choose between persian and english
  • onChange - handle what happens after changing a value
  • form - defines which form the drop-down list belongs to
  • placeholder - change the text displayed when no option is selected

Provinces type

interface IProvince {
  id: string;
  persian: string;
  english: string;
  latitude: number;
  longitude: number;
  isCapital?: boolean;
  population: number;
}

License

MIT Licensed. Copyright (c) 2023 Shirin apr

About

Iran Provinces react component

License:MIT License


Languages

Language:TypeScript 90.1%Language:JavaScript 9.9%