In pattern making, an element refers to the smallest piece of a pattern that cannot be derived from other parts of the pattern.
The element in this demo will be a single piece of text. We can create text in SVG and Lit with SVG templates as demonstrated below.
consthelloSVG=svg`<text>Hello, SVG!</text>`;
In Lit, an SVG template must be the child of an <svg> element. The <svg> element must be contained inside an HTML template. An implementation of these requirements is demonstrated by the following example.
Create a function called createElement that generates a <text> element with configurable display text using a Lit SVG template. Add text-specfic styling attributes to the <text> element.