1.0.5 • Published 1 year ago

arezki-states-selector v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Arezki States Selector

npm install rezki-states-selector

Features

This component let you choose a State (ex: New York) given a list of states, like:

const STATES = [
  {
    name: "Alabama",
    abbreviation: "AL",
  },
  {
    name: "Alaska",
    abbreviation: "AK",
  },
  {
    name: "American Samoa",
    abbreviation: "AS",
  },
  {
    name: "Arizona",
    abbreviation: "AZ",
  },
  {
    name: "Arkansas",
    abbreviation: "AR",
  },
  //...
]

Usage

To work properly, the component require to have these props:

  • states: the available options
  • state: the current value
  • onSelect: the function will be called when the user selects one of the options, the option will be passed as the first argument
import StateSelector from "arezki-states-selector"

function CreateEmployeePage() {
  const [state, setState] = useState("")

  return (
    <StateSelector
      states={STATES}
      state={state}
      onSelect={(state) => {
        setState(state)
      }}
    />
  )
}
1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago