SVG rendering utilities for Iconify icons.
Summary
Functions
Returns transformed icon body and viewBox without wrapping it in an SVG element.
Returns transformed icon data used for rendering.
Renders an icon as an SVG string.
Replaces IDs in SVG content to avoid collisions when rendering the same icon more than once.
Functions
@spec build_body( Iconify.Icon.t(), keyword() ) :: {String.t(), String.t()}
Returns transformed icon body and viewBox without wrapping it in an SVG element.
@spec build_data( Iconify.Icon.t(), keyword() ) :: %{ body: String.t(), viewbox: String.t(), width: String.t() | number(), height: String.t() | number() }
Returns transformed icon data used for rendering.
@spec render( Iconify.Icon.t(), keyword() ) :: String.t()
Renders an icon as an SVG string.
Options
:class- CSS class(es) to add:id- Element ID:fill- Fill color (default: "currentColor"):stroke- Stroke color:color- Text color used bycurrentColoricons:width- Override width. Defaults to"1em"and preserves aspect ratio:height- Override height. Defaults to"1em"and preserves aspect ratio:inline- Align icon with text baseline:mode-"svg","mask", or"bg"rendering mode:rotate- Additional 90-degree rotations:h_flip- Apply horizontal flip:v_flip- Apply vertical flip:replace_ids- Replace SVG IDs to avoid page-level collisions. Enabled by default:id_prefix- Prefix to use when replacing IDs- Any other options are added as attributes
Replaces IDs in SVG content to avoid collisions when rendering the same icon more than once.