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

183
Views
Can i implement search option for sidebar items in react?

Work Link - sidebar search

Requirement:

I need a searchbar in sidebar-top. But the special thing i need is on search it should start filtering and showing the matching menu items.

I tried it but menuitem is not changing instantaniusly as i type some key in search field.

It would be a great help.

Thanks

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

0

Do it Like this:

const [searchTerm, setSearchTerm] = useState('')
const menuItems = [
    {name: 'Home', icon: FiHome, active: true},
    {name: 'Category', icon: FaList, active: false},
    {name: 'Favourite', icon: FaRegHeart, active: false},
    {name: 'Author', icon: RiPencilLine, active: false},
    {name: 'Settings', icon: BiCog, active: false},
  ]
<SidebarContent>
     <Menu iconShape="square">
              <input type="search" placeholder="search menu items.." onChange={(e) => setSearchTerm(e.target.value)} />
              {menuItems.filter( item =>item.name.startsWith(searchTerm)).map({name, icon:Icon, active} => (
                <MenuItem active={active} icon={<Icon/>}>
                   {name}
                </MenuItem>
              )
     </Menu>
</SidebarContent>
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!