# country-react-select

> React select component for Country, State, City databases. It supports country, state and city dropdown in Reactjs.

Latest version **1.0.1** (published 2023-02-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install country-react-select
pnpm add country-react-select
yarn add country-react-select
bun add country-react-select
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-02-21 |
| First published | 2023-02-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 29.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Vu Vo |
| Maintainers | jvuvo2006 |
| Keywords | react, typescript, select, combobox, ui, country-state-picker, country-state-select |

## Links

- npm: https://www.npmjs.com/package/country-react-select
- Repository: https://github.com/jvuvo/country-react-select
- Homepage: https://github.com/jvuvo/country-react-select#readme
- Issues: https://github.com/jvuvo/country-react-select/issues
- npm.io page: https://npm.io/package/country-react-select

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2023-02-21
- 1.0.0 — 2023-02-16

## README

# Country-react-select

The Country State Select control for [React](https://reactjs.org).

Features include:

- Country picker.
- State picker.
- City picker.


# Installation and usage


```
yarn add country-react-select

or

npm instal country-react-select --save

```

## Sample code

### Country picker:

```js
import React, { useState } from 'react';
import {CountryPicker} from 'country-react-select';

export default function App() {
  const [selectedOption, setSelectedOption] = useState(null);
  return (
    <div className="App">
      <CountryPicker
        value={selectedOption}
        onChange={setSelectedOption}
      />
    </div>
  );
}
```

### CountryPickerProps

- `isDisabled` - disable the control
- `isMulti` - allow the user to select multiple values
- `onChange` - subscribe to change events
- `placeholder` - change the text displayed when no option is selected
- `value` - control the current value

### State picker:

```js
import React, { useState } from 'react';
import {StatePicker} from 'country-react-select';

export default function App() {
  const [selectedOption, setSelectedOption] = useState(null);
  return (
    <div className="App">
      <StatePicker
        value={selectedOption}
        onChange={setSelectedOption}
        country={'CA'}
      />
    </div>
  );
}
```

### City picker:

```js
import React, { useState } from 'react';
import {CityPicker} from 'country-react-select';

export default function App() {
  const [selectedOption, setSelectedOption] = useState(null);
  return (
    <div className="App">
      <CityPicker
        value={selectedOption}
        onChange={setSelectedOption}
        country={'CA'}
        state={'QC'}
      />
    </div>
  );
}
```


## License

MIT Licensed. Copyright (c) Vu Vo 2023.

---
_Source: https://npm.io/package/country-react-select · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
