[SVG JS] Adding text inside polygon

Forge Component
Published on 2018-10-25 by Frederico Sousa
1 vote
Published on 2018-10-25 by Frederico Sousa

Hello all,

is it possible for adding text inside the polygon?


By default you shouldn't add text to the polygon you should have a text or textPath or a Path (should not be your first try) to add text to your SVG.


you should go at the end with something like this.

<svg xmlns="https://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 64 64">
  <polygon fill="#F3BC23" stroke="#F3BC23" stroke-width="1" points="30,4,4,60,60,60"/>
  <text x="32" y="50" text-anchor="middle" fill="white" font-size="30">X</text>

I check this component and right now its not possible to add text Elements(via webblock). Maybe you should contribute and make that improvement or go to other component. 

Good Luck!

I'm sorry I had a very busy day.

If you check the svg.js API you can see that it allows you to draw text by using one of these methods  (Link) 

It's a matter of doing those methods. I'll try to include this asap but you can also do it and then I can add you to the component team.