font_awesome_phoenix v0.1.1 FontAwesomePhoenix.HTML

HTML helper functions for creating Font Awesome tags in Phoenix Framework templates.

Summary

Functions

Creates a Font Awesome icon tag

Functions

fa_icon(name, opts \\ [])

Specs

fa_icon(String.t, Keyword.t | none) :: {:safe, [String.t]}

Creates a Font Awesome icon tag.

Options:

  • :text - Additional text to add next to the icon
  • :align_tag - Where to align the tag next to any given text, default is :left
  • :data - Keyword list of data tag items to add to the tag

Examples:

iex> FontAwesomePhoenix.HTML.fa_icon("globe")
{:safe, ["<i class=\"fa fa-globe\">", "", "</i>"]}

iex> FontAwesomePhoenix.HTML.fa_icon("home", text: "Back to Home!")
{:safe, ["<i class=\"fa fa-home\">", "", "</i>", " Back to Home!"]}

iex> FontAwesomePhoenix.HTML.fa_icon("user-plus", text: "New User", align_tag: :right)
{:safe, ["New User ", "<i class=\"fa fa-user-plus\">", "", "</i>"]}

iex> FontAwesomePhoenix.HTML.fa_icon("location-arrow", data: [gps_enabled: true])
{:safe, ["<i class=\"fa fa-location-arrow\" data-gps-enabled=\"true\">", "", "</i>"]}