Represents an SVG element as an Elixir data structure.
Elements can be nested and rendered to SVG strings or used directly in LiveView templates.
Summary
Functions
Appends a child element. Also accepts IR.Element which will be converted.
Sets attributes on an element.
Sets text content for the element.
Converts an IR.Element to an SVG.Element.
Creates a new SVG element.
Common SVG element constructors.
Types
Functions
@spec append(t(), t() | Visualize.IR.Element.t() | [t() | Visualize.IR.Element.t()]) :: t()
Appends a child element. Also accepts IR.Element which will be converted.
Sets attributes on an element.
Sets text content for the element.
@spec from_ir(Visualize.IR.Element.t()) :: t()
Converts an IR.Element to an SVG.Element.
Creates a new SVG element.
Examples
iex> Visualize.SVG.Element.new(:rect, %{x: 0, y: 0, width: 100, height: 50})
%Visualize.SVG.Element{tag: :rect, attrs: %{x: 0, y: 0, width: 100, height: 50}, children: [], content: nil}
Common SVG element constructors.