Grapes homepage1.57.0
  • Guide
  • Tokens
  • Components
    Grapes on GithubGrapes on Figma
    Interaction
    • Button
    • IconButton
    • FloatingActionBar
    • Link
    Icons
    • Icon
    • HighlightIcon
    Form
    • AmountInput
    • Autocomplete
    • AutocompleteMultiple
    • AutocompletePlace
    • CheckboxBox
    • CheckboxField
    • DatePicker
    • FormField
    • Input
    • OptionGroup
    • PasswordInput
    • PhoneInput
    • RadioBox
    • RadioField
    • RadioGroup
    • Select
    • SwitchField
    • TextArea
    • TextInput
    • Upload
    • UploadButton
    Feedback
    • Badge
    • Banner
    • Callout
    • EmptyState
    • Modal
    • ModalSlideshow
    • DeprecatedModalSlideshow
    • PageModal
    • Skeleton
    • Tag
    • Toast
    • Tooltip
    Data display
    • Accordion
    • Avatar
    • Box
    • Calendar
    • CalendarRange
    • CollapsibleList
    • FileCard
    • InfoTip
    • ListBox
    • ListView
    • Panel
    • SidePanel
    • DeprecatedPreview
    • Table
    • Timeline
    • useDateFormatter
    Navigation
    • DropdownItem
    • DropdownMenu
    • Navigation
    • NavigationItem
    • Popover
    • Tabs

    Select

    The Select component allows the user to click and select an item from a list of options.

    View source code
    • Usage
    • Props
    • onSelect
      (value: T) => void

      Handler that is called when a option is selected.

    • options
      (T | OptionGroup<T>)[]

      The list of options.

    • value
      Option

      The current value (controlled).

    • className
      string

      className for the element.

    • dropdownContentMaxHeight
      string

      Maximum height of the dropdown content.

    • fit
      "content" | "parent"

      Whether the Select should fit its parent or content.

      Default: content
    • hasSearchBar
      boolean

      Enable a search bar inside the dropdown. Field becomes a button trigger.

      Default: false
    • isDisabled
      boolean

      Whether the Select is disabled.

    • isInvalid
      boolean

      Whether the Select is invalid.

    • name
      string

      The name of the Select, used when submitting an HTML form.

    • onBlur
      FocusEventHandler<HTMLInputElement>

      Handler that is called when the element loses focus.

    • onFocus
      FocusEventHandler<HTMLInputElement>

      Handler that is called when the element receives focus.

    • onSearch
      (value: string) => void

      Called when the dropdown search value changes. Consumer should filter options.

    • placeholder
      string

      Temporary text that occupies the Select when it is empty.

    • placement
      "bottom-end" | "bottom-start" | "end-bottom" | "end-top" | "top-end" | "top-start"

      Placement the menu will render relative to the field

    • renderNoOptions
      (rawValue: string) => ReactNode

      Render when no options are available; receives the current search value.

    • renderOption
      (option: T, state?: { isSelected: boolean; isDisabled: boolean; }) => ReactNode

      Function to render option. Should return DropdownItem(s).

    • renderOptionGroup
      (optionGroup: OptionGroup<T>) => ReactNode

      Function to render option group.

    • searchPlaceholder
      string

      The placeholder for the search bar.