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

120
Views
Icon next to text in react-select mutli label

I'm using react-select and want icons to show next to the text of each label which can be added and removed via multiSelect.

const data = [
  { label: <svg /> && 'keyword one', value: 'keyword one' },
];

Only shows either the svg or the text. Does anyone know a way around this?

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

0

You have to create your custom Option component.

Refer to this link for Custom Option components :

Also, I have created this sample sandbox example. Pardon me for bad CSS styling.

about 4 years ago · Juan Pablo Isaza Report

0

You're using && the wrong way. See short circuit evaluation for more detail. label can also accept a ReactNode, to fix the problem, define the option array as follow:

const options = [
  {
    value: "ocean",
    label: (
      <>
        <YourIcon /> Ocean
      </>
    ),
    color: "#00B8D9",
    isFixed: true
  },
  {
    value: "blue",
    label: (
      <>
        <YourIcon /> Blue
      </>
    ),
    color: "#0052CC"
  },
  {
    value: "purple",
    label: (
      <>
        <YourIcon /> Purple
      </>
    ),
    color: "#5243AA"
  }
];

Codesandbox Demo

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!