Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fa_i

Generate a Font Awesome <i> tag


Description

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, ..., html_dependency = NULL, verify_fa = TRUE)

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 Version 5 Font Awesome names. A list of short and full names can be accessed through the fa_metadata() function with fa_metadata()$icon_names and fa_metadata()$icon_names_full. If supplying a Version 4 icon name, it will be internally translated to the Version 5 icon name and a Version 5 icon will be returned. A data frame containing the short names that changed from version 4 (v4_name) to version 5 (v5_name) can be obtained by using fa_metadata()$v4_v5_name_tbl.

class

Additional classes to customize the style of the icon (see the usage examples for details on supported styles).

...

Arguments passed to the <i> tag of htmltools::tags.

html_dependency

Provides an opportunity to use a custom html_dependency object (created via a call to htmltools::htmlDependency()) instead of one supplied by the function (which uses Font Awesome's free assets and are bundled in the package). A custom html_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 is NULL where the function interally generates an html_dependency.

verify_fa

An option to verify the provided icon name. If TRUE (the default), internal checks will take place and issue messages should the name is a Font Awesome 4 icon name (the message will provide the Version 5 name), or, if the icon name cannot be found in either Font Awesome 4 or 5.

Value

An icon element.

Examples

if (interactive()) {

# Create a Font Awesome icon object
fa_i(name = "r-project")

}

fontawesome

Easily Work with 'Font Awesome' Icons

v0.2.1
MIT + file LICENSE
Authors
Richard Iannone [aut, cre] (<https://orcid.org/0000-0003-3925-190X>), Christophe Dervieux [ctb] (<https://orcid.org/0000-0003-4474-2498>), Winston Chang [ctb], Dave Gandy [ctb, cph] (Font-Awesome font), RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.