# react-form-states-select

> A react select component with the fifty states

Latest version **0.1.3** (published 2017-12-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-form-states-select
pnpm add react-form-states-select
yarn add react-form-states-select
bun add react-form-states-select
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2017-12-28 |
| First published | 2017-12-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Adam Wysocki |
| Maintainers | adamwysocki |
| Keywords | react, states, select, dropdown, react-component |

## Links

- npm: https://www.npmjs.com/package/react-form-states-select
- Repository: https://github.com/adamwysocki/react-form-states-select
- npm.io page: https://npm.io/package/react-form-states-select

## Dependencies (2)

- [eslint](https://npm.io/package/eslint.md) ^4.14.0
- [webpack](https://npm.io/package/webpack.md) ^2.6.1

## 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

- 0.1.3 (latest) — 2017-12-28
- 0.1.2 — 2017-12-28
- 0.1.1 — 2017-12-27

## README

# react-form-states-select

[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)
[ ![Codeship Status for adamwysocki/react-form-states-select](https://app.codeship.com/projects/0f13f5d0-cd5a-0135-da01-166a8e542bbe/status?branch=master)](https://app.codeship.com/projects/262034)

A React select component that displays contains the 50 US states (plus territories) and fires a callback when a new one is selected.

## Installation

```sh
yarn add react-form-states-select

- or -

npm install react-form-states-select
```

## Usage

1 . Require react-form-states-select after installation

```js
import StatesSelect from "react-form-states-select";
```

2 . Include react-form-states-select component

```js
onStateSelect = (event, state) => {
    // event {SyntheticEvent<HTMLSelectElement>} - React HTML event
    // state {Object} - Object representing the state
    // state.name {string} - The full name of the selected state
    // state.abbreviation {string} - The two letter abbreviation of the states name
}

<StatesSelect onChange={this.onStateSelect} />
```

## Parameters

| Parameter         | Type       | Description                                                                                                                                                                                                                                                                               |
| :---------------- | :--------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| onChange          | `function` | Callback with the selected state. Parameters are the HTML event and an object with the format { name: 'Maryland', abbreviation: 'MD' }                                                                                                                                                    |
| defaultOptionText | `string`   | The label to display for the default/unselected option. A user selecting this option will not fire the callback. (default: "Select a state ...")                                                                                                                                          |
| hasDefaultOption  | `boolean`  | Toggle the default option on or off (default: true)                                                                                                                                                                                                                                       |
| valueTemplate     | `string`   | A template to customize how the label in the drop down is displayed. [NAME] will display the full state name. [ABBR] will display the two character state abbreviation. (default: [NAME]). These can be used in combination. ie. "([ABBR]) - [NAME]" which will display "(MD) - Maryland" |
| style             | `Object`   | Javascript object with camelCased CSS properties rather than a CSS string. Standard React styles                                                                                                                                                                                          |
| className         | `string`   | A CSS class name. The presence of this attribute will override all default styles. So it's all or none                                                                                                                                                                                    |

## Build

```js
yarn run build
npm run build
```

## Test

```js
yarn run test
npm run test
```

## Lint

```js
yarn run lint
npm run lint
```

## Flow

```js
yarn run flow
npm run flow
```

## License

MIT

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