Function createElementNS

  • Creates an SVG Element

    Type Parameters

    Parameters

    • namespaceURI: "http://www.w3.org/2000/svg"

      W3 SVG namespace URI

    • tagName: T

      Name of element

    • Optional props: null | SVGElementProps<T>

      Element properties, such as class, id, style, etc

    • Rest ...children: ChildrenType

      Children of this element. Can be nothing, number, string, boolean, bigint, or more elements. An array will create multiple, flattened children.

    Returns SVGElementTagNameMap[T]

    SVG element

    Deprecated

    Use createElement("svg:tagname") instead

  • Creates an XHTML element

    Type Parameters

    • T extends (keyof HTMLElementTagNameMap) | (keyof HTMLElementDeprecatedTagNameMap)

    Parameters

    • namespaceURI: "http://www.w3.org/1999/xhtml"

      W3 XHTML namespace URI

    • tagName: T

      Name of element

    • Optional props: null | XHTMLElementProps<T>

      Element properties, such as class, id, style, etc

    • Rest ...children: ChildrenType

      Children of this element. Can be nothing, number, string, boolean, bigint, or more elements. An array will create multiple, flattened children.

    Returns HTMLElement

    XHTML element

    Deprecated

    Use createElement("xhtml:tagname") instead

  • Creates an MathML element

    Type Parameters

    Parameters

    • namespaceURI: "http://www.w3.org/1998/Math/MathML"

      W3 MathML namespace URI

    • tagName: T

      Name of element

    • Optional props: null | ElementProps

      Element properties, such as class, id, style, etc

    • Rest ...children: ChildrenType

      Children of this element. Can be nothing, number, string, boolean, bigint, or more elements. An array will create multiple, flattened children.

    Returns MathMLElementTagNameMap[T]

    MathML element

    Deprecated

    Use createElement("mathML:tagname") instead

  • Creates a namespaced Element. This is the most general overload that allows for any arbitrary string to be passed in to the namespaceURI param.

    Parameters

    • namespaceURI: "http://www.w3.org/XML/1998/namespace" | "http://www.w3.org/1999/xlink" | "http://www.w3.org/2000/xmlns/"

      W3 namespace URI

    • tagName: string

      Name of element

    • Optional props: null | ElementProps

      Element properties, such as class, id, style, etc

    • Rest ...children: ChildrenType

      Children of this element. Can be nothing, number, string, boolean, bigint, or more elements. An array will create multiple, flattened children.

    Returns Element

    Element

    Deprecated

    Use createElement("xml|xlink|xmlns:tagname") instead

  • Creates a namespaced Element. This is the most general overload that allows for any arbitrary string to be passed in to the namespaceURI param.

    Parameters

    • namespaceURI: null

      W3 namespace URI

    • tagName: string

      Name of element

    • Optional props: null | ElementProps

      Element properties, such as class, id, style, etc

    • Rest ...children: ChildrenType

      Children of this element. Can be nothing, number, string, boolean, bigint, or more elements. An array will create multiple, flattened children.

    Returns Element

    Element

  • Creates a namespaced Element. This is the most general overload that allows for any arbitrary string to be passed in to the namespaceURI param.

    Type Parameters

    Parameters

    • namespaceURI: T

      W3 namespace URI

    • tagName: K

      Name of element

    • Optional props: null | (T extends "http://www.w3.org/2000/svg"
          ? K extends keyof SVGElementTagNameMap
              ? SVGElementProps<K>
              : ElementProps
          : ElementProps)

      Element properties, such as class, id, style, etc

    • Rest ...children: ChildrenType

      Children of this element. Can be nothing, number, string, boolean, bigint, or more elements. An array will create multiple, flattened children.

    Returns CreateElementNSReturnType<T, K>

    Element

Generated using TypeDoc