I have the following in an SVG:
<g transform="translate(1420 1030)">
<rect x="0" y="0" width="300" height="36" class="user-1"></rect>
<image id="my-user-avatar" x="3" y="3" width="30" height="30" xlink:href="/img/user/default-avatar.png"/>
<text id="my-user-nickname" x="40" y="23">USER</text>
</g>
If the text is greater than a certain number of letters it overflows the rect
.
How do I generate in SVG the effect of a div with a background color where it grows in width based on its content, and keeps a padding to the right of 3px?