Octicons v0.8.0 Octicons View Source
Octicons are a scalable set of icons handcrafted with <3 by GitHub.
See the website for an up-to-date reference of all of the available icons.
Link to this section Summary
Functions
Retrieves the attributes of the icon or nil if the named icon doesn't exist.
Returns the SVG tag that renders the icon.
Get the version of the packaged Octicons data.
Link to this section Types
Link to this type
octicon_name() View Source
Link to this type
t()
View Source
t()
View Source
t() :: map()
t() :: map()
Link to this section Functions
Link to this function
icon(name)
View Source
icon(name)
View Source
icon(octicon_name()) :: t() | nil
icon(octicon_name()) :: t() | nil
Retrieves the attributes of the icon or nil if the named icon doesn't exist.
Examples
iex> Octicons.icon(:beaker)
%{
"aria-hidden" => "true",
"class" => "octicons octicons-beaker",
"figma" => %{"file" => "FP7lqd1V00LUaT5zvdklkkZr", "id" => "0:26"},
"height" => 16,
"keywords" => ["experiment", "labs", "experimental", "feature", "test",
"science", "education", "study", "development", "testing"],
"name" => "beaker",
"path" => "<path fill-rule=\"evenodd\" d=\"M14.38 14.59L11 7V3h1V2H3v1h1v4L.63 14.59A1 1 0 0 0 1.54 16h11.94c.72 0 1.2-.75.91-1.41h-.01zM3.75 10L5 7V3h5v4l1.25 3h-7.5zM8 8h1v1H8V8zM7 7H6V6h1v1zm0-3h1v1H7V4zm0-3H6V0h1v1z\"/>",
"symbol" => "beaker",
"version" => "1.1",
"viewBox" => "0 0 16 16",
"width" => 16
}
Link to this function
to_svg(icon, options \\ [])
View Source
(since v0.7.0)
to_svg(icon, options \\ [])
View Source
(since v0.7.0)
to_svg(octicon_name() | t(), keyword()) :: String.t()
to_svg(octicon_name() | t(), keyword()) :: String.t()
Returns the SVG tag that renders the icon.
Options
:"aria-label"Aria label for the SVG tag. Whenaria-labelis specified, thearia-hiddenattribute is removed.:classCSS class text to add to the classes already present:heightHeight in pixels to render the icon. If only:heightis specified, width is calculated to maintain the aspect ratio.:widthWidth in pixels to render the icon. If only:widthis specified, height is calculated to maintain the aspect ratio.
Examples
iex> Octicons.to_svg(:beaker)
"<svg aria-hidden=\"true\" class=\"octicons octicons-beaker\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M14.38 14.59L11 7V3h1V2H3v1h1v4L.63 14.59A1 1 0 0 0 1.54 16h11.94c.72 0 1.2-.75.91-1.41h-.01zM3.75 10L5 7V3h5v4l1.25 3h-7.5zM8 8h1v1H8V8zM7 7H6V6h1v1zm0-3h1v1H7V4zm0-3H6V0h1v1z\"/></svg>"
Link to this function
version()
View Source
version()
View Source
version() :: String.t()
version() :: String.t()
Get the version of the packaged Octicons data.
Examples
iex> Octicons.version()
"9.0.0"