Skip to content
Advertisement

Is there anyway to disable the “x” that delete a selected option in react-select?

I’m Working with react-select and I need to disable the option to delete specific selections (hide or delete the x which is in the red square)

I need to hide this x's

I have looking for a prop to do it and I found this:

isClearable={false}

But that option hide this:

I need to keep this x

In summary I need to hide the x’s shown at first image but keep the shown in the second one

Advertisement

Answer

you can try this way with know the class name for the x and hide it with CSS

1- open the console in the browser and use the select tools

enter image description here

and then use the class name in CSS as this way

className {

display: none !important;

}
Advertisement