Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

233
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda