To style the options in a react-select component, we can use the ‘styles’ prop. This prop allows us to apply custom styles to various elements within the Select component, including the options. Here’s how we can style the options:
import Select from 'react-select'; const customStyles = { option: (provided, state) => ({ ...provided, fontSize: 14, color: 'blue', backgroundColor: state.isSelected ? 'lightblue' : 'white', // Change background color for selected options }), }; const MySelect = () => ( <Select options={[1, 2, 3, 4]} placeholder="Select something" clearable={false} styles={customStyles} /> ); export default MySelect;