JSFiddle - React, Tailwind, and code Playground
HTML
<svg>
<rect x="10" y="10" width="50" height="50" fill="darkblue" />
</svg>
<p><button>Добавить</button></p>
<!-- Пример сайта know-online.com -->
CSS
svg {
height: 400px;
width: 400px;
}
JavaScript
document.querySelector("button").onclick = function(){
var svgRect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
svgRect.setAttributeNS(null, "x", Math.random() * 400);
svgRect.setAttributeNS(null, "y", Math.random() * 400);
svgRect.setAttributeNS(null, "width", 50);
svgRect.setAttributeNS(null, "height", 50);
svgRect.setAttributeNS(null, "fill", "darkblue");
document.querySelector("svg").appendChild(svgRect);
};