Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

189
Visualizações
unable to add span inside svg's <g> tag

I have this below line of code

<g id="xlabels">
            {dataArray.map(({ fullName }, index) => (
                <text
                  transform={`translate(${points[index].x + 5} ${
                    graphHeight + 10
                  }) rotate(-30.38)`}
                  style={styles["xLabel"]}
                  fill={points[index].color}
                  textAnchor="end"
                >
                  {fullName}
                </text>
            ))}
          </g>

I want to add a span inside it. for e.g.

<span>{fullName}</span>

The intention of doing so is that currently the fullName gets displayed as red color because i mentioned fill={points[index].color} but i want to display the first character as black color and rest characters should remain red as earlier.

Can someone pls let me know how to do it. I read that you cannot put div or span tags inside a svg element. Any other way i can fix this or any alternate way to achieve this ?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda