Stay organized with collections Save and categorize content based on your preferences.

blockly > utils > dom > createSvgElement

utils.dom.createSvgElement() function

Helper method for creating SVG elements.

Signature:

export declare function createSvgElement<T extends SVGElement>(name: string | Svg<T>, attrs: {
    [key: string]: string | number;
}, opt_parent?: Element | null): T;

Parameters

Parameter Type Description
name string | Svg<T> Element's tag name.
attrs { [key: string]: string | number; } Dictionary of attribute names and values.
opt_parent Element | null (Optional) Optional parent on which to append the element.

Returns:

T

if name is a string or a more specific type if it a member of Svg.