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

226
Views
How to display the avatar of all the user but it should have a limit of 6 or 4 then there will be a display all button to display the rest?

I'm creating a component in react that will display the avatar of the user but the catch is there will be limit on how many avatar will show. The solution that I'm thinking is using .slice(0,4).map then I'm gonna make a condition statement that if the length of the list is greater than 4 the button show all will appear. If the user click the button that rest of the user will pop up. The problem is how can display the rest of the user inside the pop up container?

<div className='pl-12 pr-6'>
        <div className='flex items-center justify-right'>
          {filterInfo &&
            filterInfo
              .slice(1, 10)
              .map((data) => (
                <img
                  className={`mr-2 rounded-full border-1px ${
                    active === data.creator[0]._id
                      ? 'border-primary p-0.5 opacity-100'
                      : ''
                  } cursor-pointer transition duration-75 ease-in opacity-70`}
                  key={data._id}
                  id={data.creator[0]._id}
                  src={data.creator[0].accountProfileUploaded}
                  alt={`${data.creator[0].firstName} ${data.creator[0].lastName}`}
                  title={`${data.creator[0].firstName} ${data.creator[0].lastName}`}
                  style={{ width: '40px', height: '40px' }}
                  onClick={handleOnFilterByProfile}
                />
              ))}

          {filterInfo && filterInfo.length >= 2 ? (
            <div
              className='shadow-md rounded-full relative'
              style={{ width: '40px', height: '40px' }}
            >
              <ChevronDoubleDownIcon
                className='h-4 w-4 absolute mt-3.5 ml-3 opacity-60 cursor-pointer hover:text-primary'
                aria-hidden='true'
              />
            </div>
          ) : null}
        </div>
      </div>

Thanks!

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!