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

211
Visualizações
React select - fix an option group while searching

I am using react-select on a project, and I need to fix a group on top independently of what the user is typing on the input;

To use the group feature on the react-select I used the nested way:

const options = [
  {
   label: 'example 1',
   values: group1
  },
  {
   label: 'example 2',
   values: group2
  },
]

The input has this props:

const formatGroupLabel = data => (
  <S.GroupStyles>
    {data.label && <S.GroupBadgeStyles> </S.GroupBadgeStyles>}
  </S.GroupStyles>
)

<S.DropDown
   formatGroupLabel={formatGroupLabel}
   isDisabled={disabled}
   name={input.name}
   noOptionsMessage={() => <div>Nenhum resultado</div>}
   onBlur={input.onBlur}
   onChange={option => {
     input.onChange(option.value)
   }}
   options={options}
   placeholder={placeholder}
   styles={setReactSelectStyles}
   value={value}
   />

I need that when the user try to type anything on the input, the first group be ever on top independently of what the user has typed on input, and only group 2 changes while typing.

Could anyone, please, help me to do this?

about 4 years ago · Juan Pablo Isaza
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