These are the static “content” widgets: tables, images and figures, blockquotes, display typography, and lists — plus a few small helpers. None report state to the server; they are pure UI.
bs_table() renders a faithful Bootstrap
<table class="table">. Pass a data frame or matrix as
the first argument and it builds the header and body for you; pass tag
children instead to hand-build the rows.
bs_table(
data = NULL,
..., # manual children when `data` is NULL
striped = FALSE, # TRUE / "rows", or "columns"
bordered = FALSE, # borders on all sides
borderless = FALSE, # remove all borders
hover = FALSE, # hover highlight
small = FALSE, # condensed padding
variant = NULL, # a theme colour for the whole table
responsive = FALSE, # TRUE, or a breakpoint "sm"/"md"/… for horizontal scroll
align = NULL, # vertical alignment: "middle"/"top"/"bottom"
caption = NULL,
caption_top = FALSE, # put the caption above the table
head_variant = NULL, # a theme colour for the <thead>
group_divider = FALSE, # thicker border under the header
row_variant = NULL, # per-row theme colour, recycled; NA leaves a row plain
rownames = NULL, # row names as the reference <th scope="row">
class = NULL
)The most common form — a styled data-frame table:
The accented variants from the Bootstrap tables page are arguments rather than classes you have to remember, and they compose:
bs_table(
head(mtcars, 4),
head_variant = "dark",
group_divider = TRUE,
row_variant = c(NA, "success", NA, "danger"),
caption = "Four cars",
caption_top = TRUE
)row_variant is recycled to the number of rows, so a
single value colours them all, and NA leaves a row alone.
"active" is accepted alongside the theme colours.
responsive = TRUE wraps the table so it scrolls
horizontally on narrow screens (or pass a breakpoint to only do so below
it):
bs_img() is a Bootstrap <img> with
the usual responsive utilities.
A figure groups an image with a caption. Use
bs_figure_img() and bs_figure_caption() inside
bs_figure():
bs_blockquote() renders a Bootstrap
.blockquote inside a <figure>, with an
optional attribution footer:
Two constructors cover Bootstrap’s opinionated typographic accents.
bs_display_heading() is a large, prominent heading;
level (1–6) sets both the size
(.display-{level}) and the heading element:
bs_lead() is a standout opening paragraph
(.lead):
bs_list_unstyled() strips the default list styling; each
unnamed argument becomes an <li>.
bs_list_inline() lays the items out horizontally.
You can also pass explicit tags$li() children when an
item needs richer content:
bs_list_unstyled(
tags$li(tags$code("bootstrict_theme()"), " — the designer's sheet is the theme"),
tags$li(tags$code("bs_offcanvas()"), " — the filter drawer")
)(For an interactive, selectable list, use
bs_list_group() — see Components.)
A handful of one-off utilities round out the content toolkit:
bs_icon_link() — the Bootstrap 5.3
icon-link: an inline-flex <a> pairing an icon with
text. hover = TRUE nudges the icon on hover.
bs_ratio() — wraps an embedded
element (an <iframe>, a video) so it keeps a fixed
aspect ratio. ratio is "1x1",
"4x3", "16x9" or "21x9".
bs_vr() — a vertical divider, the
vertical counterpart of <hr>. Handy between items in
an bs_hstack().
bs_visually_hidden() — content
available to assistive technology but hidden from sighted users.