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

119
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
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