Skip to Content

State Selector

A dropdown for selecting states or provinces, filtered based on the selected country. Part of the cascading location selector trio.


Import

import { StateSelector } from "@phpcreation/frontend-components-react-nextjs-bundle/components/StateSelector";

Props

PropTypeDefaultDescription
countrystring""ISO country code (from CountrySelector)
valuestring""Controlled state code
onChange(code: string) => voidChange handler
placeholderstring"Select state..."Placeholder text
disabledbooleanfalseDisable the control
classNamestringAdditional CSS classes

Usage

import { CountrySelector } from "..."; import { StateSelector } from "..."; const [country, setCountry] = useState("US"); const [state, setState] = useState(""); <CountrySelector value={country} onChange={setCountry} /> <StateSelector country={country} value={state} onChange={setState} placeholder="Select state..." />

Last updated on