Sign inDemoInstall


Package Overview
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies



A controlled input component with validation states and a label getting a selection from the user.

Version published
Weekly downloads
increased by9.73%
Weekly downloads





A controlled input component with validation states and a label getting a selection from the user.


yarn add @commercetools-uikit/select-field
npm --save install @commercetools-uikit/select-field

Additionally install the peer dependencies (if not present)

yarn add react
npm --save install react


import SelectField from '@commercetools-uikit/select-field';

const Example = () => (
      { value: 'ready', label: 'Ready' },
      { value: 'shipped', label: 'Shipped' },
    onChange={(event) => alert(}

export default Example;


idstringUsed as HTML id property. An id is generated automatically when not provided.
Possible values:
, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'
See signature.
A map of errors. Error messages for known errors are rendered automatically.
Unknown errors will be forwarded to renderError.
See signature.
This function can return a message which will be wrapped in an ErrorMessage. It can also return null to show no error.
warningsRecordA map of warnings. Warning messages for known warnings are rendered automatically.
Unknown warnings will be forwarded to renderWarning.
See signature.
Called with custom warnings, as renderWarning(key, warning). This function can return a message which will be wrapped in a WarningMessage.
It can also return null to show no warning.
isRequiredbooleanIndicates if the value is required. Shows an the "required asterisk" if so.
Possible values:
boolean[] , boolean
Indicates whether the field was touched. Errors will only be shown when the field was touched.
Possible values:
'default' , 'quiet'
Indicates the appearance of the input. Quiet appearance is meant to be used with the horizontalConstraint="auto".
aria-labelReactSelectProps['aria-label']Aria label (for assistive tech)
Props from React select was used
aria-labelledbyReactSelectProps['aria-labelledby']HTML ID of an element that should be used as the label (for assistive tech)
Props from React select was used
isAutofocussedbooleanFocus the control when it is mounted
backspaceRemovesValuebooleanRemove the currently focused option when the user presses backspace
componentsReactSelectProps['components']Map of components to overwrite the default ones, see what components you can override
Props from React select was used
controlShouldRenderValueReactSelectProps['controlShouldRenderValue']Control whether the selected values should be rendered in the control
Props from React select was used
filterOptionReactSelectProps['filterOption']Custom method to filter whether an option should be displayed in the menu
Props from React select was used
containerIdstringThe id to set on the SelectContainer component
isClearablebooleanIs the select value clearable
isDisabledbooleanIs the select disabled
isReadOnlybooleanIs the select read-only
isCondensedbooleanWhether the input and its options are rendered with condensed paddings
isOptionDisabledReactSelectProps['isOptionDisabled']Override the built-in logic to detect whether an option is disabled
Props from React select was used
isMultibooleanSupport multiple selected options
isSearchablebooleanWhether to enable search functionality
maxMenuHeightnumberMaximum height of the menu before scrolling
menuPortalTargetReactSelectProps['menuPortalTarget']Dom element to portal the select menu to
Props from React select was used
menuPortalZIndexnumberz-index value for the menu portal
Use in conjunction with menuPortalTarget
menuShouldBlockScrollbooleanwhether the menu should block scroll while open
namestringName of the HTML Input (optional - without this, no input will be rendered)
noOptionsMessageReactSelectProps['noOptionsMessage']Can be used to render a custom value when there are no options (either because of no search results, or all options have been used, or there were none in the first place). Gets called with { inputValue: String }.
inputValue will be an empty string when no search text is present.
Props from React select was used
See signature.
Handle blur events on the control
See signature.
Called with a fake event when value changes. The event's will be the name supplied in props. The event's target.value will hold the value.
The value will be the selected option, or an array of options in case isMulti is true.
onFocusReactSelectProps['onFocus']Handle focus events on the control
Props from React select was used
onInputChangeReactSelectProps['onInputChange']Handle change events on the input
Props from React select was used
Possible values:
TOption[] , TOptionObject[]
Array of options that populate the select menu
placeholderstringPlaceholder text for the select value
tabIndexReactSelectProps['tabIndex']Sets the tabIndex attribute on the input
Props from React select was used
tabSelectsValuebooleanSelect the currently focused option when the user presses tab
valueReactSelectProps['value']The value of the select; reflected by the selected option
Props from React select was used
titleReactNodeTitle of the label
hintReactNodeHint for the label. Provides a supplementary but important information regarding the behaviour of the input (e.g warn about uniqueness of a field, when it can only be set once), whereas description can describe it in more depth.
Can also receive a hintIcon.
descriptionReactNodeProvides a description for the title.
See signature.
Function called when info button is pressed.
Info button will only be visible when this prop is passed.
hintIconReactElementIcon to be displayed beside the hint text. Will only get rendered when hint is passed as well.
badgeReactNodeBadge to be displayed beside the label. Might be used to display additional information about the content of the field (E.g verified email)
hasWarningbooleanControl to indicate on the input if there are selected values that are potentially invalid @deprecated Please use the warnings prop instead so users know the reason why the field is in warning state.
iconLeftReactNodeIcon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled.
inputValueReactSelectProps['inputValue']The value of the search input
Props from React select was used


Signature errors

  missing?: boolean;

Signature renderError

(key: string, error?: boolean) => ReactNode;

Signature renderWarning

(key: string, warning?: boolean) => ReactNode;

Signature onBlur

(event: TCustomEvent) => void

Signature onChange

(event: TCustomEvent) => void

Signature onInfoButtonClick

  event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>
) => void



Last updated on 08 Jul 2024

Did you know?


Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.


Related posts

SocketSocket SOC 2 Logo


  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap


Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc