Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

223
Views
Change Background Color base React-select when its isDisabled

this is from react-select documentation

in this case, I will change color base of the select-field when

isDisabled={true}

to another color.

>     import React from "react";
>     import Select from "react-select";
>     
>     const colourOptions = [
>       { value: "red", label: "Red" },
>       { value: "green", label: "Green" },
>       { value: "blue", label: "Blue" }
>     ];
>     
>     const colourStyles = {
>       option: (styles, { data, isDisabled, isFocused, isSelected }) => {
>         // const color = chroma(data.color);
>         console.log({ data, isDisabled, isFocused, isSelected });
>         return {
>           ...styles,
>           backgroundColor: isFocused ? "#999999" : null,
>           color: "#333333"
>         };
>       }
>     };
>     
>     export default () => (
>       <Select
>         defaultValue={colourOptions[1]}
>         label="Single select"
>         options={colourOptions}
>         styles={colourStyles}
>         isDisabled={true}
>       />
>     );

my expectation, base color of the select-field can be changed to another color. enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

SOLVED

<Select
    defaultValue={flavourOptions[2]}
    options={flavourOptions}
    theme={(theme) => ({
      ...theme,
      borderRadius: 0,
      colors: {
        ...theme.colors,
        primary25: 'hotpink',
        primary: 'black',
      },
    })}
  />

primary25 is condition when isDisable = true. You can find this in react-select documentation (Overriding the theme)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!