Select

Select

import Select from "@kiwicom/orbit-components/lib/Select";
<Select options={Option} />

Props

NameTypeDefaultDescription
dataAttrsObjectOptional prop for passing data-* attributes to the input DOM element.
dataTeststringOptional prop for testing purposes.
disabledbooleanfalseIf true, the Select will be disabled.
errorReact.NodeThe error message for the Select. See Functional specs
helpReact.NodeThe help message for the Select.
idstringAdds id HTML attribute to an element.
labelTranslationThe label for the Select.
inlineLabelbooleanIf true the label renders on the left side of the Select.
namestringThe name for the Select.
onBlurevent => void \| PromiseFunction for handling onBlur event.
onChangeevent => void \| PromiseFunction for handling onChange event.
onFocusevent => void \| PromiseFunction for handling onFocus event.
optionsOption[]The content of the Select, passed as array of objects.
placeholderTranslationStringThe placeholder for the Select.
prefixReact.NodeThe prefix component for the Select. See Functional specs
reffuncProp for forwarded ref of the Select. See Functional specs
requiredbooleanfalseIf true, the label is displayed as required.
spaceAfterenumAdditional margin-bottom after component.
tabIndexstring \| numberSpecifies the tab order of an element
valuestring""The value of the Select.
widthstring100%Specifies width of the Select
helpClosablebooleantrueWhether to display help as a closable tooltip, or have it open only while the field is focused, same as error.
customValueTextstringThe custom text alternative of current value. See Functional specs.

enum

spaceAfter
"none"
"smallest"
"small"
"normal"
"medium"
"large"
"largest"

Option

NameTypeDescription
valuestring \| numberThe value of the Option.
labelstringThe label for the Option.
keystringThe key of the Option.
disabledbooleanIf true, the Option will be disabled.

Functional specs

class Component extends React.PureComponent<Props> {
componentDidMount() {
this.ref.current && this.ref.current.focus();
}
ref: { current: React.ElementRef<*> | null } = React.createRef();
render() {
return <Select ref={this.ref} />;
}
}