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

188
Views
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
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!