Interface SVGAttributes

A more specific representation of the attributes that are permitted on SVG elements.

https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute The value of all attributes MUST be string.

interface SVGAttributes {
    class?: string;
    clip-rule?: "nonzero" | "evenodd" | "inherit";
    cx?: string;
    cy?: string;
    d?: string;
    direction?: "ltr" | "rtl";
    dominant-baseline?:
        | "auto"
        | "text-bottom"
        | "alphabetic"
        | "ideographic"
        | "middle"
        | "central"
        | "mathematical"
        | "hanging"
        | "text-top";
    dx?: string;
    dy?: string;
    fill?: string;
    fill-opacity?: string;
    font-family?: string;
    font-size?: string;
    font-style?: "normal" | "italic" | "oblique";
    font-weight?: string;
    fx?: string;
    fy?: string;
    gradientUnits?: "userSpaceOnUse" | "objectBoundingBox";
    height?: string;
    href?: string;
    id?: string;
    line-height?: string;
    offset?: string;
    opacity?: string;
    r?: string;
    spreadMethod?: "reflect" | "pad" | "repeat";
    stop-color?: string;
    stop-opacity?: string;
    stroke?: string;
    stroke-dasharray?: string;
    stroke-dashoffset?: string;
    stroke-linecap?: "butt" | "round" | "square";
    stroke-linejoin?:
        | "round"
        | "arcs"
        | "bevel"
        | "miter"
        | "miter-clip";
    stroke-miterlimit?: string;
    stroke-opacity?: string;
    stroke-width?: string;
    text-anchor?: "middle" | "start" | "end";
    text-decoration?: string;
    transform?: string;
    vector-effect?:
        | "none"
        | "non-scaling-stroke"
        | "non-scaling-size"
        | "non-rotation"
        | "fixed-position";
    visibility?: "visible" | "hidden" | "collapse";
    width?: string;
    x?: string;
    x1?: string;
    x2?: string;
    y?: string;
    y1?: string;
    y2?: string;
    [name: string]: string;
}

Indexable

  • [name: string]: string

Properties

class?: string
clip-rule?: "nonzero" | "evenodd" | "inherit"
cx?: string
cy?: string
d?: string

Defines the path to be drawn as a list of path commands and their parameters.

direction?: "ltr" | "rtl"
dominant-baseline?:
    | "auto"
    | "text-bottom"
    | "alphabetic"
    | "ideographic"
    | "middle"
    | "central"
    | "mathematical"
    | "hanging"
    | "text-top"
dx?: string
dy?: string
fill?: string
fill-opacity?: string
font-family?: string
font-size?: string
font-style?: "normal" | "italic" | "oblique"
font-weight?: string
fx?: string
fy?: string
gradientUnits?: "userSpaceOnUse" | "objectBoundingBox"
height?: string
href?: string
id?: string
line-height?: string
offset?: string

TODO: offset is not a documented SVG attribute. How do we account for it?

opacity?: string
r?: string
spreadMethod?: "reflect" | "pad" | "repeat"
stop-color?: string
stop-opacity?: string
stroke?: string
stroke-dasharray?: string
stroke-dashoffset?: string
stroke-linecap?: "butt" | "round" | "square"
stroke-linejoin?:
    | "round"
    | "arcs"
    | "bevel"
    | "miter"
    | "miter-clip"
stroke-miterlimit?: string
stroke-opacity?: string
stroke-width?: string
text-anchor?: "middle" | "start" | "end"
text-decoration?: string
transform?: string
vector-effect?:
    | "none"
    | "non-scaling-stroke"
    | "non-scaling-size"
    | "non-rotation"
    | "fixed-position"
visibility?: "visible" | "hidden" | "collapse"
width?: string
x?: string
x1?: string
x2?: string
y?: string
y1?: string
y2?: string