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

221
Views
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
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!