Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

210
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda