PhoenixSVG behaviour (phoenix_svg v1.1.0)
View SourceInline SVG component for Phoenix. Check out the README to get started.
Options
:otp_app- The name of your OTP application. This is required.:as- The name of the generated component function. Defaults to:svg.:from- The path of your svg files relative to your project directory. If using releases, make sure this path is included in your release directory (privis included by default). Defaults topriv/svgs.:attributes- A keyword list of default attributes to inject into the SVG tags. Defaults to[].
Example
use PhoenixSVG,
otp_app: :myapp,
as: :icon,
from: "priv/static/icons",
attributes: [width: "24px", height: "24px"]<.icon name="checkmark" />
Summary
Callbacks
Renders an inline SVG using a cached file.
Callbacks
@callback svg(assigns :: map()) :: Phoenix.LiveView.Rendered.t()
Renders an inline SVG using a cached file.
Attributes
:name- The name of the svg file, excluding the.svgextension.:path- A list of nested paths if the file is not in the root.
Any other attributes will be passed through to the SVG tag.