React-select: Remove Options Drop-Down

Created on 11 Feb 2017  路  7Comments  路  Source: JedWatson/react-select

Is it possible to remove the drop-down for creatable? So it simply works like an input box for tags, without a select?

Most helpful comment

The replaceableComponents API gives you full control over how each component renders, so to remove the Dropdown you can just return null:

<Select
  // other props
  components={{ DropdownIndicator: () => null }}
/>

you'll probably want to remove the separator as well:

<Select
  // other props
  components={
    {
      DropdownIndicator: () => null,
      IndicatorSeparator: () => null
    }
  }
/>

All 7 comments

You can hide it via CSS:

.hide-options .Select-arrow-zone {
    display: none;
}

.hide-options .Select-menu-outer {
    display: none;
}
<Creatable
    className="hide-options"
/>

In addition to the answer provided by @avinmathew , add the following overridden style to normalise the react-select when focused

.Select.is-open > .Select-control {
  border-bottom-right-radius: 4px !important;
  border-bottom-left-radius: 4px !important;
}

For V2, it is quite hackish in order to remove the dropdown. I did it by using the following css selector.
.hide-options > div > div:last-child { display:none; }

Is there any plan to implement this feature on react-select?

Looks like this is it: https://react-select.com/creatable (latest example)

The replaceableComponents API gives you full control over how each component renders, so to remove the Dropdown you can just return null:

<Select
  // other props
  components={{ DropdownIndicator: () => null }}
/>

you'll probably want to remove the separator as well:

<Select
  // other props
  components={
    {
      DropdownIndicator: () => null,
      IndicatorSeparator: () => null
    }
  }
/>

To hide the dropdown (aka Menu):

<Select
  // other props
  components={
    {
      DropdownIndicator: () => null,
      IndicatorSeparator: () => null,
      Menu: () => null,
    }
  }
/>

Documentation link: https://react-select.com/components

Hello -

In an effort to sustain the react-select project going forward, we're closing old issues.

We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our efforts towards the current major version.

If you aren't using the latest version of react-select please consider upgrading to see if it resolves any issues you're having.

However, if you feel this issue is still relevant and you'd like us to review it - please leave a comment and we'll do our best to get back to you!

Was this page helpful?
0 / 5 - 0 ratings