1.0.5 • Published 1 year ago
arezki-states-selector v1.0.5
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 optionsstate
: the current valueonSelect
: 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)
}}
/>
)
}