Learn R Programming

fontawesome (version 0.2.2)

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)

Value

An icon element.

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.

Examples

Run this code
if (interactive()) {

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

}

Run the code above in your browser using DataLab