Skip to main content

Props

These are the props that can be passed to the two components. Any other valid HTML select attributes that aren't specified here will be passed through and added to the select fields. If you've defined a customRender method (see integrations), check out customProps as a means to pass arbitrary props to your render method.

<CountryDropdown />

ParameterRequired?DefaultTypeDescription
valueYes""stringThe currently selected country. This should either be the shortcode, or the full country name depending on what you're using for your value attribute (see the valueType option). By default it's the full country name.
onChangeYes-functionCallback that gets called when the user selects a country. Use this to store the value in whatever store you're using (or just the parent component state).
onBlurNo-functionCallback that gets called when the user blurs off the country field.
nameNo"rcrs-country"stringThe name attribute of the generated select box.
idNo""stringThe ID of the generated select box. Not added by default.
classNameNo""stringAny additional space-separated classes you want to add.
showDefaultOptionNotruebooleanWhether you want to show a default option.
priorityOptionsNoarray[]Lets you target countries that should appear at the top of the dropdown. Should also be an array of country shortcodes.
defaultOptionLabelNo"Select Country"stringThe default option label.
labelTypeNo"full"stringEither "full" or "short". This governs whether you see country names or country short codes in the dropdown.
valueTypeNo"full"stringEither "full" or "short". This controls the actual value attribute of each <option> in the dropdown. Please note, if you set this to "short" you will need to let the corresponding <RegionDropdown /> component know as well, by passing a countryValueType="short" attribute.
whitelistNo[]arrayThis setting lets you target specific countries to appear in the dropdown. Only those specified here will appear. This should be an array of country shortcodes. See the country-region-data repo for the data and the shortcodes.
blacklistNo[]arrayLets you target countries that should not appear in the dropdown. Should also be an array of country shortcodes.
disabledNofalsebooleanDisables the country field.
customRenderNo-functionOverrides the default render method to let you control the output for the dropdown. See the integrations section for examples.
customPropsNo-objectThis can be used to pass additional data to your customRender function if you're handling your own rendering.

<RegionDropdown />

ParameterRequired?DefaultTypeDescription
countryYes""stringThe currently selected country.
valueYes""stringThe currently selected region.
onChangeYes-functionCallback that gets called when the user selects a region. Use this to store the value in whatever store you're using (or just the parent component state).
onBlurNo-functionCallback that gets called when the user blurs off the region field.
nameNo"rcrs-region"stringThe name attribute of the generated select box.
idNo""stringThe ID of the generated select box. Not added by default.
classNameNo""stringAny additional space-separated classes you want to add.
blankOptionLabelNo-stringThe label that appears in the region dropdown when the user hasn't selected a country yet.
showDefaultOptionNotruebooleanWhether you want to show a default option. This is what the user sees in the region dropdown after selecting a country. It defaults to the defaultOptionLabel setting (see next).
defaultOptionLabelNoSelect RegionstringThe default region option.
onChangeNo-functionCalled when the user selects a region. Use this to store the region value.
countryValueTypeNofullstringIf you've changed the country dropdown valueType to short you will need to set this value to short as well, so the component knows what's being passed in the country property.
labelTypeNo"full"stringEither "full" or "short". This governs whether you see region names or region short codes in the dropdown.
valueTypeNo"full"stringEither "full" or "short". This controls the actual value attribute of each <option> in the dropdown.
disableWhenEmptyNofalsebooleanDisables the region field when the user hasn't selected a country.
disabledNofalsebooleanDisables the region field. If set to true, it overrides disableWhenEmpty
customOptionsNo[]Array<string>Appends a list of string to the every region dropdown, regardless of the country selected.
whitelistNo{ CountryCode: [] }objectThis setting lets you target specific regions to appear in the dropdown. Only those specified here will appear. This should be an array of region codes keyed by the country code.
blacklistNo{ CountryCode: [] }objectThis setting lets you target specific regions that should not appear in the dropdown. This should be an array of region codes keyed by the country code.
disableWhenEmptyNofalsebooleanDisables the region field when the user hasn't selected a country.
disabledNofalsebooleanDisables the region field. If set to true, it overrides disableWhenEmpty
customRenderNo-functionOverrides the default render method to let you control the output for the dropdown. See the integrations section for examples.
customPropsNo-objectThis can be used to pass additional data to your customRender function if you're handling your own rendering.