The fa_i()
function creates a Font Awesome <i>
tag and not an SVG as with
fa()
. The primary use case for fa_i()
is for legacy Shiny applications
that use the shiny::icon()
function. This function is called within a
shiny::icon()
call and all HTML dependencies to support icon generation are
hosted in the fontawesome package.
Usage
fa_i(
name,
class = NULL,
...,
prefer_type = c("regular", "solid"),
html_dependency = fa_html_dependency()
)
Arguments
- name
The name of the Font Awesome icon. This could be as a short name (e.g.,
"npm"
,"drum"
, etc.), or, a full name (e.g.,"fab fa-npm"
,"fas fa-drum"
, etc.). The names should correspond to current Font Awesome names. A list of short and full names can be accessed through thefa_metadata()
function withfa_metadata()$icon_names
andfa_metadata()$icon_names_full
. If supplying a known alias to a short icon name (e.g.,"vcard"
, which is now"address-card"
), it will be internally translated to the current icon name before returning the icon tag.- class
Additional classes to customize the style of the icon.
- ...
Arguments passed to the
<i>
tag of htmltools::tags.- prefer_type
Chooses the type of icon returned if: (1) providing a short name, and (2) that icon has both solid and regular types. For example, using
name = "address-book"
will result in two types of icons for an Address Book. By default, this preference is set to"regular"
and the other option is"solid"
.- html_dependency
Provides an opportunity to use a custom
html_dependency
object (created via a call tohtmltools::htmlDependency()
) instead of one supplied by the function (which uses Font Awesome's free assets and are bundled in the package). A customhtml_dependency
object is useful when you have paid icons from Font Awesome or would otherwise like to customize exactly which icon assets are used (e.g.,woff
,woff2
,eot
, etc.). By default, this isNULL
where the function internally generates anhtml_dependency
.
Examples
if (interactive()) {
# Create a Font Awesome icon object
fa_i(name = "r-project")
}