Skip to main content
Version: <=v1.1.11

Region Select

info

The RegionSelect component allows users to select a region or continent from a predefined list.

Usage

import React, { useState } from "react";
import { RegionSelect } from "react-country-state-city";
import "react-country-state-city/dist/react-country-state-city.css";

export default function App() {
const [region, setRegion] = useState(null);

return (
<div>
<h6>Region / Continent</h6>
<RegionSelect
containerClassName="form-group"
inputClassName=""
onChange={(_region) => setRegion(_region)}
onTextChange={(_txt) => console.log(_txt)}
defaultValue={region}
placeHolder="Select Region"
/>
</div>
);
}

Live Example

Props

NameTypeDefaultRequiredDescription
srcstring""The relative or absolute URL where the data files are hosted.
defaultValueRegionnullThe current selected region object.
containerClassNamestring""CSS class for the container.
inputClassNamestring""CSS class for the input box.
onChange(region:Region) => voidundefinedCallback triggered when the selected region changes.
onTextChange(text:string) => voidundefinedCallback fired when the input text changes.
placeHolderstring""Placeholder text displayed in the empty input.