Bacancy Technology
Bacancy Technology represents the connected world, offering innovative and customer-centric information technology experiences, enabling Enterprises, Associates and the Society to Rise™.
12+
Countries where we have happy customers
1050+
Agile enabled employees
06
World wide offices
12+
Years of Experience
05
Agile Coaches
14
Certified Scrum Masters
1000+
Clients projects
1458
Happy customers
Artificial Intelligence
Machine Learning
Salesforce
Microsoft
SAP
November 8, 2023
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;