Use Bootstrap icons (as inline SVG)
bs_icon(
name,
size = "1em",
class = NULL,
title = NULL,
a11y = c("auto", "deco", "sem", "none"),
...
)
The name of the Bootstrap icon. Whitespace is replaced with -
(that way, "arrow up"
can be used to refer to the "actual name" of
"arrow-up"
). For a searchable list of names, see https://icons.getbootstrap.com/
Any valid CSS unit defining both the height and width of the icon.
Additional CSS classes to add to the <svg>
element. Consider
providing Bootstrap 5+ utility classes (e.g., text-success
) here to
stylize the icon (but also note that those utility classes will only work
when Bootstrap 5+ is on the page).
If provided (highly recommended), a11y
defaults to "sem"
,
meaning the title is used for on-hover text and screen reader
announcements.
Cases that distinguish the role of the icon and inform which
accessibility attributes to be used. Icons can either be "deco"
(decorative, the default case), "sem"
(semantic), "none"
(no
accessibility features). The default, "auto"
, resolves to "sem"
if a
title
is provided (and "deco"
otherwise).
additional CSS properties (e.g., margin
, position
, etc.)
placed on the <svg>
tag.
An htmltools::HTML()
string containing the SVG icon.
up <- bs_icon("arrow-up-circle", size = "9em", class = "text-success")
up_fill <- bs_icon("arrow-up-circle-fill", size = "9em", class = "text-success")
# utility class will only apply with a modern version of Bootstrap
if (interactive() && requireNamespace('bslib')) {
bslib::page_fluid(up, up_fill)
}