Vaadin 25's Element API now supports creating and modifying SVG and MathML elements directly in Java, eliminating the need for string-based SVG construction. This enables developers to build interactive vector graphics programmatically with type safety, attach event listeners to SVG elements, and update specific DOM nodes incrementally. The change allows treating SVG as a first-class component surface rather than markup strings, with practical applications like clickable chart segments and dynamic line drawing between components. Helper classes in the Viritin library provide typed, IDE-friendly APIs for common SVG elements and path operations.
Table of contents
What changed?Why it mattersGoodbye SVG string-buildingA fun real-world test: clickable wind roseSVG gotcha: camelCased attributesHelper classes: typed SVG API for component authorsSort: