Select

A customizable dropdown select component with animated feedback, search capabilities, and flexible styling options.

Usage

import { Select } from '@smartacteam/react-native-ui';
<Select
  placeholder="Choose an option"
  label="Category"
  value={selectedValue}
  onChange={setSelectedValue}
>
  <Select.Item label="Option 1" value="option1" />
  <Select.Item label="Option 2" value="option2" />
  <Select.Item label="Option 3" value="option3" />
</Select>

Example

Preview

Props

Select Props

NameTypeRequiredDescription
childrenReact.ReactElement<ItemProps>[]YesArray of Select.Item components that define the dropdown options.
onChange(val: any) => voidNoCallback function called when a selection is made.
valueValueNoCurrently selected value that matches one of the item values.
labelstringNoLabel displayed above the select component.
searchbarbooleanNoAdds search bar to select.
formNamestringNoOptional identifier for form integration
descriptionstringNoHelper or error description displayed below the select.
errorbooleanNoDisplays error styling if true.
disabledbooleanNoDisables the select and changes its style accordingly.
placeholderstringNoPlaceholder text shown when no value is selected.
leftComponentReact.ReactNodeNoCustom element rendered to the left of the select container.
rightComponentReact.ReactNodeNoCustom element rendered to the right of the select container.
startPrefixReact.ReactNodeNoElement rendered inside the select at the start (left side).
endPrefixReact.ReactNodeNoElement rendered inside the select at the end (right side). Defaults to chevron icon.
container_*BaseSmacStylingNoPrefixed props that apply styles to the outer container (e.g. container_mt_4).
onFocus(e: any) => voidNoCallback called when the dropdown opens.
onBlur(e: any) => voidNoCallback called when the dropdown closes.
(Inherited)BaseSmacStylingNoAll base SMAC styling props.

Select.Item Props

NameTypeRequiredDescription
valueValueYesThe value associated with this item.
labelstringNoDisplay text for the item.
onChange(val: Value) => voidNoCallback function (automatically passed by parent Select).
selectedbooleanNoWhether this item is currently selected (automatically determined).
(Inherited)ButtonPropsNoAll Button component props are available.

Features

  • Animated Interactions: Smooth chevron rotation and border color transitions
  • Error States: Automatic border and description color changes for validation feedback
  • Flexible Styling: Support for both default and chat-style appearances
  • Custom Components: Add left/right components and start/end prefixes
  • Scrollable Menu: Dropdown menu with scroll support for long option lists
  • Accessibility: Built on top of accessible button and dropdown components

The dropdown menu automatically adjusts its width to match the select button and has a maximum height of 240 pixels with scrolling enabled.

Error state triggers animated border and description color changes similar to the Input component.

Style props prefixed with container_ apply to the root wrapper <View> around the entire select component.

See BaseSmacStyling and ButtonProps for additional inherited styling options.