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

58
Vistas
How to set up styled component props type so the styled component can take more than one prop?

Let's say I have the following component with 1 prop - title:

<StyledBaseButton title="test" />

I would add the prop type like this:

const StyledBaseButton = styled(BaseButton)<{ title: string }>`
    background-color: ${colors.primary600};
    border-color: ${colors.primary600};
`;

However, if I want to add a second prop like this:

<StyledBaseButton title="test" wide />

And attempt to add the second prop to the styled component like this:

const StyledBaseButton = styled(BaseButton)<{ title: string, wide: boolean }>`
    background-color: ${colors.primary600};
    border-color: ${colors.primary600};
`;

It doesn't work and I imagine I'm messing up the styled component syntax. I tried google-ing the issue, but all the solutions always show how to do it with 1 prop only, and I can already do that. What I can't figure out is how to use more than one props.

about 4 years ago · Juan Pablo Isaza
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