# defs
The defs
element is used to store graphical objects that will be used at a later time. Objects created inside a defs
element are not rendered directly. To display them you have to reference them (with a use
element for example).
Usually, this element is created with:
const defs = parentElement.add('defs')
It's possible to create it as a disconnected element with gySVG('defs')
and attach it to the SVG document with .attachTo()
.
More info: mdn (opens new window) | w3c (opens new window)
Parent elements: a | defs | g | marker | mask | pattern | svg | symbol.
Child elements: a | animate | animateMotion | animateTransform | circle | clipPath | defs | desc | discard | ellipse | filter | foreignObject | g | image | line | linearGradient | marker | mask | metadata | mpath | path | pattern | polygon | polyline | radialGradient | rect | set | stop | style | svg | switch | symbol | text | title | use | view.