Skip to content

Documentation / @ripl/svg / createContext

Function: createContext() ​

createContext(target, options?): SVGContext

Defined in: svg/src/context.ts:828

Creates an SVG rendering context (a concrete Context) attached to the given DOM target.

Parameters ​

ParameterTypeDescription
targetstring | HTMLElementA DOM element or CSS selector identifying the element to mount the SVG into.
options?ContextOptions<Record<string, unknown>>Optional context configuration such as interactivity and metadata.

Returns ​

SVGContext

The constructed SVGContext.

Example ​

ts
const context = createContext(target);