| Title: | Strict Bootstrap 5.3 Widgets for Shiny |
|---|---|
| Description: | A complete, faithful implementation of the Bootstrap 5.3 component, layout and form library as Shiny UI functions. Every widget mirrors the Bootstrap 5.3 HTML structure one-to-one so that a designer's mockup and SASS variables can be dropped into a Shiny application with minimal deviation from Shiny's own conventions. Interactive components report their state to the server and can be controlled server-side through update functions and proxies. Theming is delegated to 'bslib' (which ships the Bootstrap 5.3 runtime) so designer-provided SASS variable sheets compose natively. |
| Authors: | Colin Fay [aut, cre] |
| Maintainer: | Colin Fay <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-07-02 15:22:16 UTC |
| Source: | https://github.com/ThinkR-open/bootstrict |
Loads every JavaScript file shipped in inst/assets/js, forcing
bootstrict-core.js first (it defines the window.bootstrict namespace that
the per-component binding files rely on), followed by the supporting
stylesheet. Component binding files are discovered dynamically, so adding a
new binding is just a matter of dropping a .js file in that directory.
The dependency is built once per session and cached (every widget calls
this, and the installed files cannot change mid-session).
bootstrict_dep()bootstrict_dep()
A thin wrapper around bslib::bs_theme() pinned to Bootstrap 5 that also
accepts a designer's exported SASS variable sheet. Variables from
variables are merged with (and overridden by) any variables passed through
..., then handed to bslib.
bootstrict_theme(..., variables = NULL, bootswatch = NULL, preset = NULL)bootstrict_theme(..., variables = NULL, bootswatch = NULL, preset = NULL)
... |
Sass variables / arguments forwarded to |
variables |
Optional path to a |
bootswatch, preset
|
Optional Bootswatch / preset name (see
|
A bslib::bs_theme() object.
if (interactive()) { bootstrict_theme(primary = "#ff6600", "font-size-base" = "1rem") }if (interactive()) { bootstrict_theme(primary = "#ff6600", "font-size-base" = "1rem") }
A vertically collapsing set of panels. The value(s) of the currently open
panel(s) are reported to the server as input$id, and can be driven
server-side with update_bs_accordion().
bs_accordion( id, ..., open = NULL, multiple = FALSE, flush = FALSE, class = NULL ) bs_accordion_panel( title, ..., value = NULL, icon = NULL, class = NULL, body_class = NULL )bs_accordion( id, ..., open = NULL, multiple = FALSE, flush = FALSE, class = NULL ) bs_accordion_panel( title, ..., value = NULL, icon = NULL, class = NULL, body_class = NULL )
id |
Accordion id; open panel value(s) available as |
... |
Panels built with |
open |
Panel value(s) open initially. Use |
multiple |
If |
flush |
If |
class |
Extra classes. |
title |
Panel header content. |
value |
Panel identifier reported to the server (defaults to |
icon |
Optional icon placed before the title. |
body_class |
Extra classes for the panel body. |
An accordion tag.
bs_accordion( "acc", bs_accordion_panel("First", "Panel one body", value = "one"), bs_accordion_panel("Second", "Panel two body", value = "two"), open = "one" )bs_accordion( "acc", bs_accordion_panel("First", "Panel one body", value = "one"), bs_accordion_panel("Second", "Panel two body", value = "two"), open = "one" )
Bootstrap alert
bs_alert(..., color = "primary", dismissible = FALSE, class = NULL) bs_alert_heading(..., level = 4, class = NULL) bs_alert_link(..., href = "#", class = NULL)bs_alert(..., color = "primary", dismissible = FALSE, class = NULL) bs_alert_heading(..., level = 4, class = NULL) bs_alert_link(..., href = "#", class = NULL)
... |
Alert content and named HTML attributes. |
color |
Theme colour ( |
dismissible |
If |
class |
Extra classes. |
level |
Heading level (1-6). |
href |
Link target. |
An alert tag.
bs_alert("Well done!", color = "success") bs_alert("Heads up.", color = "warning", dismissible = TRUE)bs_alert("Well done!", color = "success") bs_alert("Heads up.", color = "warning", dismissible = TRUE)
A small count / labelling component rendered as a <span class="badge">.
bs_badge(..., color = "primary", pill = FALSE, class = NULL)bs_badge(..., color = "primary", pill = FALSE, class = NULL)
... |
Badge content and named HTML attributes. |
color |
Theme colour ( |
pill |
If |
class |
Extra classes. |
A badge tag.
bs_badge("New", color = "success")bs_badge("New", color = "success")
Bootstrap blockquote
bs_blockquote(..., footer = NULL, class = NULL)bs_blockquote(..., footer = NULL, class = NULL)
... |
Quote content and named HTML attributes applied to the
|
footer |
Optional source/attribution rendered in a
|
class |
Extra classes applied to the |
A figure tag wrapping the blockquote.
bs_blockquote("A well-known quote.", footer = "Someone famous")bs_blockquote("A well-known quote.", footer = "Someone famous")
A navigation hierarchy. Compose with bs_breadcrumb_item().
bs_breadcrumb(..., divider = NULL, label = "breadcrumb", class = NULL) bs_breadcrumb_item(..., active = FALSE, href = NULL, class = NULL)bs_breadcrumb(..., divider = NULL, label = "breadcrumb", class = NULL) bs_breadcrumb_item(..., active = FALSE, href = NULL, class = NULL)
... |
Breadcrumb items built with |
divider |
Optional custom divider character (e.g. |
label |
Accessible label for the |
class |
Extra classes applied to the |
active |
If |
href |
Optional link target. Ignored when |
A breadcrumb <nav> tag.
bs_breadcrumb( bs_breadcrumb_item("Home", href = "#"), bs_breadcrumb_item("Library", active = TRUE) )bs_breadcrumb( bs_breadcrumb_item("Home", href = "#"), bs_breadcrumb_item("Library", active = TRUE) )
Renders a Bootstrap 5 button. When id is supplied the button is wired as a
Shiny action button: input$id holds the click count, exactly like
shiny::actionButton().
bs_button( id = NULL, label = NULL, ..., color = "primary", outline = FALSE, size = NULL, disabled = FALSE, href = NULL, type = "button", class = NULL )bs_button( id = NULL, label = NULL, ..., color = "primary", outline = FALSE, size = NULL, disabled = FALSE, href = NULL, type = "button", class = NULL )
id |
Optional input id. When set, the click count is reported as
|
label |
Button label (text or tags). Can also be passed via |
... |
Additional content and named HTML attributes. |
color |
One of the eight Bootstrap theme colours, or |
outline |
If |
size |
|
disabled |
If |
href |
Optional URL; renders an |
type |
Button |
class |
Extra classes. |
A button (or anchor) tag.
bs_button("go", "Go", color = "primary") bs_button(label = "Cancel", color = "secondary", outline = TRUE)bs_button("go", "Go", color = "primary") bs_button(label = "Cancel", color = "secondary", outline = TRUE)
Bootstrap button group / toolbar
bs_button_group(..., size = NULL, vertical = FALSE, label = NULL, class = NULL) bs_button_toolbar(..., label = NULL, class = NULL)bs_button_group(..., size = NULL, vertical = FALSE, label = NULL, class = NULL) bs_button_toolbar(..., label = NULL, class = NULL)
... |
Buttons ( |
size |
|
vertical |
If |
label |
Accessible label ( |
class |
Extra classes. |
A button group / toolbar tag.
bs_button_group(bs_button(label = "Left"), bs_button(label = "Right"))bs_button_group(bs_button(label = "Left"), bs_button(label = "Right"))
A flexible content container. Compose with bs_card_header(),
bs_card_body(), bs_card_footer(), bs_card_img() and the card text
helpers.
bs_card(..., color = NULL, border = NULL, class = NULL) bs_card_body(..., class = NULL) bs_card_header(..., class = NULL) bs_card_footer(..., class = NULL) bs_card_title(..., level = 5, class = NULL) bs_card_subtitle(..., level = 6, class = NULL) bs_card_text(..., class = NULL) bs_card_link(..., href = "#", class = NULL) bs_card_img( src, position = c("top", "bottom", "overlay"), alt = NULL, ..., class = NULL ) bs_card_img_overlay(..., class = NULL) bs_card_group(..., class = NULL)bs_card(..., color = NULL, border = NULL, class = NULL) bs_card_body(..., class = NULL) bs_card_header(..., class = NULL) bs_card_footer(..., class = NULL) bs_card_title(..., level = 5, class = NULL) bs_card_subtitle(..., level = 6, class = NULL) bs_card_text(..., class = NULL) bs_card_link(..., href = "#", class = NULL) bs_card_img( src, position = c("top", "bottom", "overlay"), alt = NULL, ..., class = NULL ) bs_card_img_overlay(..., class = NULL) bs_card_group(..., class = NULL)
... |
Card content (headers, bodies, images, ...) and named HTML attributes. |
color |
Background theme colour ( |
border |
Border theme colour ( |
class |
Extra classes. |
level |
Heading level (1-6) for the card title / subtitle. |
href |
Link target for |
src |
Image source URL. |
position |
Image placement: |
alt |
Image alt text. |
A card tag.
bs_card( bs_card_header("Featured"), bs_card_body( bs_card_title("Card title"), bs_card_text("Some quick example text.") ) )bs_card( bs_card_header("Featured"), bs_card_body( bs_card_title("Card title"), bs_card_text("Some quick example text.") ) )
A slideshow component for cycling through a series of items
(bs_carousel_item()s). The 0-based index of the active slide is reported
to the server as input$id, and can be driven server-side with
update_bs_carousel().
bs_carousel( id, ..., indicators = TRUE, controls = TRUE, fade = FALSE, autoplay = TRUE, interval = NULL, dark = FALSE, class = NULL ) bs_carousel_item( ..., active = FALSE, interval = NULL, caption = NULL, class = NULL )bs_carousel( id, ..., indicators = TRUE, controls = TRUE, fade = FALSE, autoplay = TRUE, interval = NULL, dark = FALSE, class = NULL ) bs_carousel_item( ..., active = FALSE, interval = NULL, caption = NULL, class = NULL )
id |
Carousel id; the active slide index is available as |
... |
Items built with |
indicators |
If |
controls |
If |
fade |
If |
autoplay |
If |
interval |
Cycling interval in milliseconds (sets |
dark |
If |
class |
Extra classes. |
active |
If |
caption |
Optional caption content placed in a |
A carousel tag.
bs_carousel( "demo", bs_carousel_item(htmltools::img(src = "1.jpg"), active = TRUE), bs_carousel_item(htmltools::img(src = "2.jpg")) )bs_carousel( "demo", bs_carousel_item(htmltools::img(src = "1.jpg"), active = TRUE), bs_carousel_item(htmltools::img(src = "2.jpg")) )
Delegates to shiny::checkboxGroupInput() and rewrites the markup to
Bootstrap 5 .form-check shape so the value stays available as input$id.
bs_checkbox_group_input( id, label = NULL, choices, selected = NULL, ..., inline = FALSE, reverse = FALSE, help = NULL, width = NULL )bs_checkbox_group_input( id, label = NULL, choices, selected = NULL, ..., inline = FALSE, reverse = FALSE, help = NULL, width = NULL )
id |
Input id; selected value available as |
label |
Input label. |
choices |
Named or unnamed vector / list of choices. |
selected |
Initially selected value(s). |
... |
Extra attributes applied to each radio |
inline |
If |
reverse |
If |
help |
Help text rendered below the control ( |
width |
CSS width (e.g. |
A form control tag.
bs_checkbox_group_input("opts", "Options", c("A", "B", "C"), selected = "A")bs_checkbox_group_input("opts", "Options", c("A", "B", "C"), selected = "A")
Bootstrap checkbox input
bs_checkbox_input( id, label = NULL, value = FALSE, ..., switch = FALSE, reverse = FALSE, help = NULL, width = NULL ) bs_switch_input( id, label = NULL, value = FALSE, ..., reverse = FALSE, help = NULL, width = NULL )bs_checkbox_input( id, label = NULL, value = FALSE, ..., switch = FALSE, reverse = FALSE, help = NULL, width = NULL ) bs_switch_input( id, label = NULL, value = FALSE, ..., reverse = FALSE, help = NULL, width = NULL )
id |
Input id; value available as |
label |
Input label. |
value |
Initial checked state. |
... |
Extra attributes applied to the |
switch |
If |
reverse |
If |
help |
Help text rendered below the control ( |
width |
CSS width (e.g. |
A form control tag.
bs_checkbox_input("agree", "I agree", TRUE) bs_checkbox_input("dark", "Dark mode", switch = TRUE)bs_checkbox_input("agree", "I agree", TRUE) bs_checkbox_input("dark", "Dark mode", switch = TRUE)
Bootstrap close button
bs_close_button(..., label = "Close", white = FALSE, class = NULL)bs_close_button(..., label = "Close", white = FALSE, class = NULL)
... |
Named HTML attributes (e.g. |
label |
Accessible label. |
white |
If |
class |
Extra classes. |
A button tag.
Bootstrap grid column
bs_col( ..., width = NULL, sm = NULL, md = NULL, lg = NULL, xl = NULL, xxl = NULL, offset = NULL, order = NULL, align_self = NULL, class = NULL )bs_col( ..., width = NULL, sm = NULL, md = NULL, lg = NULL, xl = NULL, xxl = NULL, offset = NULL, order = NULL, align_self = NULL, class = NULL )
... |
Content, and named HTML attributes. |
width |
Base column span: an integer |
sm, md, lg, xl, xxl
|
Per-breakpoint spans (integer, |
offset |
Column offset. A single value applies at the base breakpoint;
a named list sets per-breakpoint offsets (e.g. |
order |
Column order ( |
align_self |
Vertical self-alignment: |
class |
Extra classes. |
A column tag.
bs_col(width = 6, md = 4, "content")bs_col(width = 6, md = 4, "content")
A toggleable container that shows or hides content. Pair it with a
bs_collapse_trigger() (declarative, no server round trip) and/or drive it
from the server with update_bs_collapse(). Its shown/hidden state is
reported to the server as input$id (TRUE when visible).
bs_collapse(id, ..., open = FALSE, horizontal = FALSE, class = NULL)bs_collapse(id, ..., open = FALSE, horizontal = FALSE, class = NULL)
id |
Collapse id; visibility state available as |
... |
Collapse content and named HTML attributes. |
open |
If |
horizontal |
If |
class |
Extra classes. |
A collapse tag.
bs_collapse("more", "Hidden content revealed on toggle.")bs_collapse("more", "Hidden content revealed on toggle.")
Renders a control that toggles the bs_collapse() whose id matches
target, using Bootstrap's declarative data-bs-toggle="collapse"
attributes (no server round trip required).
bs_collapse_trigger(target, ..., button = TRUE, expanded = FALSE, class = NULL)bs_collapse_trigger(target, ..., button = TRUE, expanded = FALSE, class = NULL)
target |
Id of the |
... |
Content (label) and named HTML attributes. |
button |
If |
expanded |
Initial expanded state of the trigger. Set to |
class |
Extra classes. |
A button (or anchor) tag.
bs_collapse_trigger("more", "Toggle")bs_collapse_trigger("more", "Toggle")
A native <input type="color" class="form-control form-control-color"> whose
value (a "#rrggbb" string) is reported as input$id. Drive it server-side
with update_bs_color().
bs_color_input( id, label = NULL, value = "#000000", ..., help = NULL, width = NULL )bs_color_input( id, label = NULL, value = "#000000", ..., help = NULL, width = NULL )
id |
Input id; value available as |
label |
Input label. |
value |
Initial colour as a hex string (e.g. |
... |
Extra attributes applied to the |
help |
Help text rendered below the control ( |
width |
CSS width (e.g. |
A form control tag.
bs_color_input("col", "Pick a colour", value = "#0d6efd")bs_color_input("col", "Pick a colour", value = "#0d6efd")
Bootstrap container
bs_container(..., fluid = FALSE, breakpoint = NULL, class = NULL)bs_container(..., fluid = FALSE, breakpoint = NULL, class = NULL)
... |
Content, and named HTML attributes. |
fluid |
If |
breakpoint |
One of |
class |
Extra classes. |
A container tag.
bs_container(bs_row(bs_col("a"), bs_col("b")))bs_container(bs_row(bs_col("a"), bs_col("b")))
Delegates to shiny::dateInput() and adds the Bootstrap .form-label /
.form-control affordances.
bs_date_input( id, label = NULL, value = NULL, ..., min = NULL, max = NULL, help = NULL, width = NULL )bs_date_input( id, label = NULL, value = NULL, ..., min = NULL, max = NULL, help = NULL, width = NULL )
id |
Input id; selected value available as |
label |
Input label. |
value |
Initial date (a |
... |
Extra attributes applied to each radio |
min, max
|
Minimum / maximum selectable date. |
help |
Help text rendered below the control ( |
width |
CSS width (e.g. |
A form control tag.
bs_date_input("day", "Pick a day", value = "2026-06-26")bs_date_input("day", "Pick a day", value = "2026-06-26")
Delegates to shiny::dateRangeInput() and adds the Bootstrap .form-label /
.form-control affordances.
bs_date_range_input( id, label = NULL, start = NULL, end = NULL, ..., min = NULL, max = NULL, help = NULL, width = NULL )bs_date_range_input( id, label = NULL, start = NULL, end = NULL, ..., min = NULL, max = NULL, help = NULL, width = NULL )
id |
Input id; selected value available as |
label |
Input label. |
start, end
|
Initial start / end dates. |
... |
Extra attributes applied to each radio |
min, max
|
Minimum / maximum selectable date. |
help |
Help text rendered below the control ( |
width |
CSS width (e.g. |
A form control tag.
bs_date_range_input("range", "Period", start = "2026-01-01", end = "2026-12-31")bs_date_range_input("range", "Period", start = "2026-01-01", end = "2026-12-31")
A larger, slightly more opinionated heading style (.display-*).
bs_display_heading(..., level = 1, class = NULL)bs_display_heading(..., level = 1, class = NULL)
... |
Heading content and named HTML attributes. |
level |
Display size / heading level (1-6). |
class |
Extra classes. |
A heading tag.
bs_display_heading("Display heading", level = 2)bs_display_heading("Display heading", level = 2)
A toggleable menu of links, headers and dividers. Compose the menu with
bs_dropdown_item(), bs_dropdown_divider(), bs_dropdown_header() and
bs_dropdown_text(). Bootstrap drives the toggle; give an item an id to
wire it as a Shiny action button (input$id).
bs_dropdown( label, ..., color = "secondary", outline = FALSE, size = NULL, split = FALSE, direction = "down", dark = FALSE, align = NULL, class = NULL ) bs_dropdown_item( ..., id = NULL, href = "#", active = FALSE, disabled = FALSE, class = NULL ) bs_dropdown_divider(class = NULL) bs_dropdown_header(..., level = 6, class = NULL) bs_dropdown_text(..., class = NULL)bs_dropdown( label, ..., color = "secondary", outline = FALSE, size = NULL, split = FALSE, direction = "down", dark = FALSE, align = NULL, class = NULL ) bs_dropdown_item( ..., id = NULL, href = "#", active = FALSE, disabled = FALSE, class = NULL ) bs_dropdown_divider(class = NULL) bs_dropdown_header(..., level = 6, class = NULL) bs_dropdown_text(..., class = NULL)
label |
Toggle button label (text or tags). |
... |
Menu contents (dropdown items, dividers, headers, text) and named HTML attributes (forwarded to the wrapper). |
color |
Toggle button theme colour, one of the Bootstrap theme colours
or |
outline |
If |
size |
Toggle button size: |
split |
If |
direction |
Menu drop direction: |
dark |
If |
align |
Menu alignment. |
class |
Extra classes for the wrapper. |
id |
Optional input id. When set, the item becomes a Shiny action
button and its click count is reported as |
href |
Link target. |
active |
If |
disabled |
If |
level |
Heading level (1-6) for the dropdown header. |
A dropdown tag.
bs_dropdown("Menu", bs_dropdown_item("Action", id = "act"))bs_dropdown("Menu", bs_dropdown_item("Action", id = "act"))
Group an image with a caption. Compose bs_figure() with bs_figure_img()
and bs_figure_caption().
bs_figure(..., class = NULL) bs_figure_img(src, ..., alt = NULL, class = NULL) bs_figure_caption(..., class = NULL)bs_figure(..., class = NULL) bs_figure_img(src, ..., alt = NULL, class = NULL) bs_figure_caption(..., class = NULL)
... |
Figure content (image, caption) and named HTML attributes. |
class |
Extra classes. |
src |
Image source URL. |
alt |
Alternative text. |
A figure tag.
bs_figure( bs_figure_img("photo.jpg", alt = "A photo"), bs_figure_caption("A caption for the image.") )bs_figure( bs_figure_img("photo.jpg", alt = "A photo"), bs_figure_caption("A caption for the image.") )
Delegates to shiny::fileInput() and adapts its markup to Bootstrap 5.
bs_file_input( id, label = NULL, ..., multiple = FALSE, accept = NULL, button_label = "Browse...", placeholder = "No file selected", width = NULL )bs_file_input( id, label = NULL, ..., multiple = FALSE, accept = NULL, button_label = "Browse...", placeholder = "No file selected", width = NULL )
id |
Input id; selected value available as |
label |
Input label. |
... |
Extra attributes applied to the |
multiple |
Allow selecting more than one file. |
accept |
Character vector of accepted MIME types / extensions. |
button_label |
Label shown on the browse button. |
placeholder |
Placeholder text shown before a file is chosen. |
width |
CSS width (e.g. |
shiny hides the real <input type="file"> off-screen (top: -99999px) and
relies on Bootstrap 3 .btn-file CSS to bring it back over the browse
button. That CSS is absent under Bootstrap 5, so clicking the button focuses
the off-screen input and the browser scrolls the page to the top. We fix this
by overlaying the input on the button (invisible, opacity: 0) so a click
lands on it directly, and restyle the browse button as a real Bootstrap 5
button.
A form control tag.
bs_file_input("upload", "Upload a file", accept = ".csv")bs_file_input("upload", "Upload a file", accept = ".csv")
Reshape a control built by one of the bs_*_input() constructors (e.g.
bs_text_input(), bs_select_input()) into a Bootstrap 5 floating-label
group, where the label animates into the control's border. The existing
control and its Shiny input wiring are preserved (the element is moved, not
rebuilt), so the value still reports as input$id.
bs_floating_label(input, label = NULL, class = NULL)bs_floating_label(input, label = NULL, class = NULL)
input |
A control tag tree produced by a |
label |
Floating label text. If |
class |
Extra classes. |
A .form-floating wrapper tag.
bs_floating_label(bs_text_input("email", "Email address"))bs_floating_label(bs_text_input("email", "Email address"))
A plain <form> container for grouping form controls.
bs_form(..., novalidate = FALSE, class = NULL)bs_form(..., novalidate = FALSE, class = NULL)
... |
Form content (controls, layout, buttons) and named HTML attributes. |
novalidate |
If |
class |
Extra classes. |
A form tag.
bs_form( bs_text_input("email", "Email"), bs_button("Submit", color = "primary") )bs_form( bs_text_input("email", "Email"), bs_button("Submit", color = "primary") )
A <label class="form-label"> tied to a control via its for attribute.
bs_form_label(for_id, ..., class = NULL)bs_form_label(for_id, ..., class = NULL)
for_id |
The id of the control this label describes (rendered as the
|
... |
Label content and named HTML attributes. |
class |
Extra classes. |
A label tag.
bs_form_label("email", "Email address")bs_form_label("email", "Email address")
Muted helper text rendered below a control (.form-text).
bs_form_text(..., class = NULL)bs_form_text(..., class = NULL)
... |
Help content and named HTML attributes. |
class |
Extra classes. |
A div tag.
bs_form_text("Must be 8-20 characters long.")bs_form_text("Must be 8-20 characters long.")
Shorthand flex helpers added in Bootstrap 5.1. bs_hstack() lays children
out in a row, bs_vstack() in a column.
bs_hstack(..., gap = NULL, class = NULL) bs_vstack(..., gap = NULL, class = NULL)bs_hstack(..., gap = NULL, class = NULL) bs_vstack(..., gap = NULL, class = NULL)
... |
Content, and named HTML attributes. |
gap |
Spacing between items ( |
class |
Extra classes. |
A stack tag.
bs_hstack(bs_button(label = "A"), bs_button(label = "B"), gap = 2) bs_vstack(bs_alert("one"), bs_alert("two"), gap = 3)bs_hstack(bs_button(label = "A"), bs_button(label = "B"), gap = 2) bs_vstack(bs_alert("one"), bs_alert("two"), gap = 3)
The Bootstrap 5.3 icon-link helper: an inline flex <a> that pairs an
icon (e.g. an SVG) with text, with an optional hover translation of the
icon (.icon-link-hover).
bs_icon_link(..., href = "#", hover = FALSE, class = NULL)bs_icon_link(..., href = "#", hover = FALSE, class = NULL)
... |
Link content (icon and text) and named HTML attributes. |
href |
Link target. |
hover |
If |
class |
Extra classes. |
An anchor tag.
bs_icon_link("Icon link", href = "#")bs_icon_link("Icon link", href = "#")
Bootstrap image
bs_img( src, ..., fluid = FALSE, thumbnail = FALSE, rounded = FALSE, object_fit = NULL, alt = NULL, class = NULL )bs_img( src, ..., fluid = FALSE, thumbnail = FALSE, rounded = FALSE, object_fit = NULL, alt = NULL, class = NULL )
src |
Image source URL. |
... |
Extra named HTML attributes applied to the |
fluid |
Make the image responsive ( |
thumbnail |
Render with a rounded thumbnail border ( |
rounded |
Add rounded corners ( |
object_fit |
How the image fills its box (Bootstrap 5.3
|
alt |
Alternative text. |
class |
Extra classes. |
An image tag.
bs_img("logo.png", alt = "Logo", fluid = TRUE)bs_img("logo.png", alt = "Logo", fluid = TRUE)
Groups one or more form controls together with add-ons (text, buttons, dropdowns) on a single line.
bs_input_group(..., size = NULL, class = NULL) bs_input_group_text(..., class = NULL)bs_input_group(..., size = NULL, class = NULL) bs_input_group_text(..., class = NULL)
... |
Controls and add-ons (e.g. |
size |
Control size: |
class |
Extra classes. |
When a full bs_*_input() is passed, only its bare control is kept
so it sits flush with the add-ons: the input's label and help text are
dropped (compose them outside the group). Inputs whose Shiny binding lives
on their container — bs_date_input(), bs_date_range_input(),
bs_file_input(), bs_radio_input(), bs_checkbox_group_input() —
cannot be unwrapped this way and raise an error.
An input-group tag.
bs_input_group( bs_input_group_text("@"), bs_text_input("user", placeholder = "Username") )bs_input_group( bs_input_group_text("@"), bs_text_input("user", placeholder = "Username") )
A standout opening paragraph (.lead).
bs_lead(..., class = NULL)bs_lead(..., class = NULL)
... |
Paragraph content and named HTML attributes. |
class |
Extra classes. |
A paragraph tag.
bs_lead("This is a lead paragraph.")bs_lead("This is a lead paragraph.")
A flexible container for displaying a series of content. Compose with
bs_list_group_item(). When id is supplied the group becomes selectable:
clicking an action item (action = TRUE or href) reports that item's
value (its data-value) as input$id, and the selection can be driven
server-side with update_bs_list_group().
bs_list_group( id = NULL, ..., flush = FALSE, numbered = FALSE, horizontal = FALSE, class = NULL ) bs_list_group_item( ..., value = NULL, active = FALSE, disabled = FALSE, color = NULL, action = FALSE, href = NULL, class = NULL )bs_list_group( id = NULL, ..., flush = FALSE, numbered = FALSE, horizontal = FALSE, class = NULL ) bs_list_group_item( ..., value = NULL, active = FALSE, disabled = FALSE, color = NULL, action = FALSE, href = NULL, class = NULL )
id |
Optional list group id. When set, the active item's value is
reported as |
... |
List items built with |
flush |
If |
numbered |
If |
horizontal |
Lay items out horizontally. |
class |
Extra classes. |
value |
Item value reported to the server when selected (its
|
active |
If |
disabled |
If |
color |
Contextual theme colour ( |
action |
If |
href |
Link target; renders the item as an |
A list group tag.
bs_list_group( bs_list_group_item("An item"), bs_list_group_item("A second item", active = TRUE) ) bs_list_group_item("A link item", href = "#", value = "a")bs_list_group( bs_list_group_item("An item"), bs_list_group_item("A second item", active = TRUE) ) bs_list_group_item("A link item", href = "#", value = "a")
Remove a list's default styling (.list-unstyled) or lay items out inline
(.list-inline). Each unnamed ... argument becomes one <li>; named
arguments become attributes of the <ul>.
bs_list_unstyled(..., class = NULL) bs_list_inline(..., class = NULL)bs_list_unstyled(..., class = NULL) bs_list_inline(..., class = NULL)
... |
List items (unnamed) and named HTML attributes for the |
class |
Extra classes. |
An unordered list tag.
bs_list_unstyled("First", "Second", "Third") bs_list_inline("One", "Two", "Three")bs_list_unstyled("First", "Second", "Third") bs_list_inline("One", "Two", "Three")
A faithful Bootstrap 5 modal dialog. The modal's open/closed state is
reported to the server as input$id (TRUE when shown), and can be driven
server-side with show_bs_modal(), hide_bs_modal() and toggle_bs_modal().
bs_modal( id, ..., title = NULL, footer = NULL, size = NULL, centered = FALSE, scrollable = FALSE, fullscreen = FALSE, backdrop = TRUE, keyboard = TRUE, class = NULL ) bs_modal_header(..., class = NULL) bs_modal_title(..., level = 1, class = NULL) bs_modal_body(..., class = NULL) bs_modal_footer(..., class = NULL)bs_modal( id, ..., title = NULL, footer = NULL, size = NULL, centered = FALSE, scrollable = FALSE, fullscreen = FALSE, backdrop = TRUE, keyboard = TRUE, class = NULL ) bs_modal_header(..., class = NULL) bs_modal_title(..., level = 1, class = NULL) bs_modal_body(..., class = NULL) bs_modal_footer(..., class = NULL)
id |
Modal id; open state available as |
... |
Modal body content and named HTML attributes applied to the root. |
title |
Optional header title. When supplied, a |
footer |
Optional footer content (e.g. buttons), placed in a
|
size |
Dialog size: |
centered |
If |
scrollable |
If |
fullscreen |
|
backdrop |
Backdrop behaviour: |
keyboard |
If |
class |
Extra classes. |
level |
Heading level (1-6) for the modal title. |
For full control over the dialog structure (in place of the title and
footer shortcuts) compose the body yourself with bs_modal_header(),
bs_modal_body() and bs_modal_footer().
A modal tag.
bs_modal("info", "Modal body text.", title = "Heads up")bs_modal("info", "Modal body text.", title = "Heads up")
Renders a button that opens the modal whose id matches target, using
Bootstrap's declarative data-bs-toggle="modal" attributes (no server round
trip required).
bs_modal_trigger(target, ..., class = NULL)bs_modal_trigger(target, ..., class = NULL)
target |
Id of the |
... |
Content (label) and named HTML attributes, forwarded to
|
class |
Extra classes. |
A button tag.
bs_modal_trigger("info", "Open modal", color = "primary")bs_modal_trigger("info", "Open modal", color = "primary")
Builds a toast on the client and shows it, much like
shiny::showNotification(). A toast container is created on demand at
placement if one is not already present, and the toast removes itself from
the DOM once hidden.
bs_notify_toast( body, ..., title = NULL, color = NULL, autohide = TRUE, delay = 5000, placement = "top-end", session = shiny::getDefaultReactiveDomain() )bs_notify_toast( body, ..., title = NULL, color = NULL, autohide = TRUE, delay = 5000, placement = "top-end", session = shiny::getDefaultReactiveDomain() )
body |
Notification body text. Plain text only (it is inserted with
|
... |
Reserved for future extensions; must be empty. |
title |
Optional header title. Plain text only, like |
color |
Optional theme colour applied as a |
autohide |
If |
delay |
Delay in milliseconds before the toast auto-hides. |
placement |
Container placement (see |
session |
The Shiny session. |
Invisibly NULL, called for its side effect.
if (interactive()) bs_notify_toast("Saved!", title = "Status", color = "success")if (interactive()) bs_notify_toast("Saved!", title = "Status", color = "success")
Bootstrap numeric input
bs_numeric_input( id, label = NULL, value = NULL, ..., min = NULL, max = NULL, step = NULL, size = NULL, help = NULL, width = NULL )bs_numeric_input( id, label = NULL, value = NULL, ..., min = NULL, max = NULL, step = NULL, size = NULL, help = NULL, width = NULL )
id |
Input id; value available as |
label |
Input label. |
value |
Initial value. |
... |
Extra attributes applied to the |
min, max, step
|
Numeric bounds and step. |
size |
Control size: |
help |
Help text rendered below the control ( |
width |
CSS width (e.g. |
A form control tag.
A hidden sidebar panel that slides in from an edge of the viewport. The
open/closed state is reported to the server as input$id (TRUE when
shown), and can be driven server-side with show_bs_offcanvas(),
hide_bs_offcanvas() and toggle_bs_offcanvas(). Open it declaratively from
the UI with bs_offcanvas_trigger().
bs_offcanvas( id, ..., title = NULL, placement = "start", backdrop = TRUE, scroll = FALSE, responsive = NULL, class = NULL )bs_offcanvas( id, ..., title = NULL, placement = "start", backdrop = TRUE, scroll = FALSE, responsive = NULL, class = NULL )
id |
Offcanvas id; open state available as |
... |
Offcanvas body content and named HTML attributes applied to the root. |
title |
Optional header title. When supplied, an |
placement |
Edge the panel slides in from: |
backdrop |
Backdrop behaviour: |
scroll |
If |
responsive |
Optional breakpoint ( |
class |
Extra classes. |
An offcanvas tag.
bs_offcanvas("menu", "Sidebar content.", title = "Menu") bs_offcanvas("nav", "Shown inline on lg+.", responsive = "lg")bs_offcanvas("menu", "Sidebar content.", title = "Menu") bs_offcanvas("nav", "Shown inline on lg+.", responsive = "lg")
Renders a button that opens the offcanvas whose id matches target, using
Bootstrap's declarative data-bs-toggle="offcanvas" attributes (no server
round trip required).
bs_offcanvas_trigger(target, ..., class = NULL)bs_offcanvas_trigger(target, ..., class = NULL)
target |
Id of the |
... |
Content (label) and named HTML attributes, forwarded to
|
class |
Extra classes. |
A button tag.
bs_offcanvas_trigger("menu", "Open menu")bs_offcanvas_trigger("menu", "Open menu")
Thin wrappers over bslib::page() / bslib::page_fluid() pinned to
Bootstrap 5 that wire in the bootstrict dependency and default theme. Use
these as the outermost call of a Shiny UI.
bs_page( ..., title = NULL, theme = bootstrict_theme(), color_mode = NULL, lang = "en" ) bs_page_fluid( ..., title = NULL, theme = bootstrict_theme(), color_mode = NULL, lang = "en" ) bs_page_fillable( ..., title = NULL, theme = bootstrict_theme(), color_mode = NULL, lang = "en" )bs_page( ..., title = NULL, theme = bootstrict_theme(), color_mode = NULL, lang = "en" ) bs_page_fluid( ..., title = NULL, theme = bootstrict_theme(), color_mode = NULL, lang = "en" ) bs_page_fillable( ..., title = NULL, theme = bootstrict_theme(), color_mode = NULL, lang = "en" )
... |
UI elements, and named HTML attributes for the page body. |
title |
Page title (browser tab). |
theme |
A |
color_mode |
Initial Bootstrap colour mode ( |
lang |
Document language ( |
A UI definition.
if (interactive()) { bs_page( theme = bootstrict_theme(primary = "#ff6600"), bs_container(bs_card(bs_card_body("Hello"))) ) }if (interactive()) { bs_page( theme = bootstrict_theme(primary = "#ff6600"), bs_container(bs_card(bs_card_body("Hello"))) ) }
A single <li class="page-item"> carrying a .page-link anchor. Use inside
bs_pagination().
bs_page_item(..., href = "#", active = FALSE, disabled = FALSE, class = NULL)bs_page_item(..., href = "#", active = FALSE, disabled = FALSE, class = NULL)
... |
Link content (text or tags) and named HTML attributes applied to
the |
href |
Link target. |
active |
If |
disabled |
If |
class |
Extra classes for the |
A <li> page-item tag.
bs_page_item("1", href = "#", active = TRUE)bs_page_item("1", href = "#", active = TRUE)
A list of page links, built from bs_page_item()s. For a quick numbered
pager use bs_pagination_numbered().
bs_pagination( ..., size = NULL, align = NULL, label = "Page navigation", class = NULL )bs_pagination( ..., size = NULL, align = NULL, label = "Page navigation", class = NULL )
... |
Page items built with |
size |
Size modifier: |
align |
Horizontal alignment of the pager: |
label |
Accessible label for the surrounding |
class |
Extra classes for the |
A <nav> pagination tag.
bs_pagination( bs_page_item("Previous", href = "#"), bs_page_item("1", href = "#", active = TRUE), bs_page_item("2", href = "#"), bs_page_item("Next", href = "#") )bs_pagination( bs_page_item("Previous", href = "#"), bs_page_item("1", href = "#", active = TRUE), bs_page_item("2", href = "#"), bs_page_item("Next", href = "#") )
Convenience wrapper around bs_pagination() that lays out a "Previous"
control, page numbers 1..n (the current one active) and a "Next" control.
bs_pagination_numbered( n, current = 1, ..., href_template = NULL, size = NULL, align = NULL, label = "Page navigation", class = NULL )bs_pagination_numbered( n, current = 1, ..., href_template = NULL, size = NULL, align = NULL, label = "Page navigation", class = NULL )
n |
Total number of pages. |
current |
Currently active page number (1-based). |
... |
Additional named HTML attributes forwarded to |
href_template |
Optional |
size |
Size modifier passed to |
align |
Alignment passed to |
label |
Accessible label passed to |
class |
Extra classes for the |
A <nav> pagination tag.
bs_pagination_numbered(5, current = 2)bs_pagination_numbered(5, current = 2)
Bootstrap password input
bs_password_input( id, label = NULL, value = "", ..., size = NULL, help = NULL, width = NULL )bs_password_input( id, label = NULL, value = "", ..., size = NULL, help = NULL, width = NULL )
id |
Input id; value available as |
label |
Input label. |
value |
Initial value. |
... |
Extra attributes applied to the |
size |
Control size: |
help |
Help text rendered below the control ( |
width |
CSS width (e.g. |
A form control tag.
Loading placeholders ("skeletons") that mimic the shape of content while it
loads. Use bs_placeholder() for an individual placeholder and wrap one or
more in bs_placeholder_glow() or bs_placeholder_wave() to animate them.
bs_placeholder(..., width = NULL, color = NULL, size = NULL, class = NULL) bs_placeholder_glow(..., class = NULL) bs_placeholder_wave(..., class = NULL)bs_placeholder(..., width = NULL, color = NULL, size = NULL, class = NULL) bs_placeholder_glow(..., class = NULL) bs_placeholder_wave(..., class = NULL)
... |
Additional named HTML attributes (and, for the wrappers, child content) applied to the element. |
width |
Column count (integer 1-12) controlling the placeholder width
via the grid ( |
color |
Background theme colour ( |
size |
Placeholder size, one of |
class |
Extra classes. |
A placeholder tag.
bs_placeholder_glow(bs_placeholder(width = 6))bs_placeholder_glow(bs_placeholder(width = 6))
Decorates an existing tag with the data attributes Bootstrap needs to render a popover. Popovers are initialised client-side by bootstrict (Bootstrap does not auto-initialise them).
bs_popover( tag, content, ..., title = NULL, placement = "right", trigger = "click", html = FALSE )bs_popover( tag, content, ..., title = NULL, placement = "right", trigger = "click", html = FALSE )
tag |
A UI element (a |
content |
Popover body content (or HTML, when |
... |
Extra named attributes applied to |
title |
Optional popover header. |
placement |
Popover placement: one of |
trigger |
How the popover is triggered (e.g. |
html |
If |
The decorated tag, with the bootstrict dependency attached.
bs_popover(shiny::tags$button("Click me"), "Popover body", title = "Heads up")bs_popover(shiny::tags$button("Click me"), "Popover body", title = "Heads up")
A progress display. bs_progress_bar() builds one bar (a .progress
track with its .progress-bar); bs_progress() finalises it, or stacks
several bars into a Bootstrap 5.3 .progress-stacked group. Progress is
display-only (it reports no value to the server); drive it from the server
with update_bs_progress().
bs_progress(..., height = NULL, class = NULL) bs_progress_bar( value = 0, ..., min = 0, max = 100, color = NULL, striped = FALSE, animated = FALSE, label = NULL, aria_label = NULL, id = NULL, class = NULL )bs_progress(..., height = NULL, class = NULL) bs_progress_bar( value = 0, ..., min = 0, max = 100, color = NULL, striped = FALSE, animated = FALSE, label = NULL, aria_label = NULL, id = NULL, class = NULL )
... |
One or more |
height |
CSS height of the progress track(s) (e.g. |
class |
Extra classes. |
value |
Current value of the bar. |
min, max
|
Lower and upper bounds of the scale. |
color |
Bar theme colour ( |
striped |
If |
animated |
If |
label |
Text shown inside the bar. |
aria_label |
Accessible name of the progress track ( |
id |
Id of the |
A progress tag.
bs_progress(bs_progress_bar(value = 25, id = "load")) # stacked (Bootstrap 5.3): bs_progress( bs_progress_bar(value = 15, color = "success"), bs_progress_bar(value = 30, color = "danger") ) bs_progress_bar(value = 75, color = "success", striped = TRUE)bs_progress(bs_progress_bar(value = 25, id = "load")) # stacked (Bootstrap 5.3): bs_progress( bs_progress_bar(value = 15, color = "success"), bs_progress_bar(value = 30, color = "danger") ) bs_progress_bar(value = 75, color = "success", striped = TRUE)
Delegates to shiny::radioButtons() and rewrites the markup to Bootstrap 5
.form-check shape so the value stays available as input$id.
bs_radio_input( id, label = NULL, choices, selected = NULL, ..., inline = FALSE, reverse = FALSE, help = NULL, width = NULL )bs_radio_input( id, label = NULL, choices, selected = NULL, ..., inline = FALSE, reverse = FALSE, help = NULL, width = NULL )
id |
Input id; selected value available as |
label |
Input label. |
choices |
Named or unnamed vector / list of choices. |
selected |
Initially selected value. |
... |
Extra attributes applied to each radio |
inline |
If |
reverse |
If |
help |
Help text rendered below the control ( |
width |
CSS width (e.g. |
A form control tag.
bs_radio_input("size", "Size", c("S", "M", "L"), selected = "M")bs_radio_input("size", "Size", c("S", "M", "L"), selected = "M")
A native <input type="range" class="form-range"> whose value is reported to
the server as input$id. Drive it server-side with update_bs_range().
bs_range_input( id, label = NULL, value = NULL, min = 0, max = 100, step = NULL, ..., help = NULL, width = NULL )bs_range_input( id, label = NULL, value = NULL, min = 0, max = 100, step = NULL, ..., help = NULL, width = NULL )
id |
Input id; value available as |
label |
Input label. |
value |
Initial value. If |
min, max, step
|
Numeric bounds and step. |
... |
Extra attributes applied to the |
help |
Help text rendered below the control ( |
width |
CSS width (e.g. |
A form control tag.
bs_range_input("vol", "Volume", value = 50, min = 0, max = 100)bs_range_input("vol", "Volume", value = 50, min = 0, max = 100)
Wraps an embedded element (image, iframe, video, ...) so it keeps a fixed
aspect ratio (.ratio).
bs_ratio(..., ratio = "16x9", class = NULL)bs_ratio(..., ratio = "16x9", class = NULL)
... |
The embedded element and named HTML attributes. |
ratio |
Aspect ratio: one of |
class |
Extra classes. |
A <div> tag.
bs_ratio(shiny::tags$iframe(src = "https://example.com"), ratio = "16x9")bs_ratio(shiny::tags$iframe(src = "https://example.com"), ratio = "16x9")
Bootstrap grid row
bs_row( ..., cols = NULL, gutters = NULL, gx = NULL, gy = NULL, justify = NULL, align = NULL, class = NULL )bs_row( ..., cols = NULL, gutters = NULL, gx = NULL, gy = NULL, justify = NULL, align = NULL, class = NULL )
... |
Columns ( |
cols |
Number of equal-width columns per row ( |
gutters, gx, gy
|
Gutter width |
justify |
Horizontal alignment of columns: |
align |
Vertical alignment of columns: |
class |
Extra classes. |
A row tag.
bs_row(bs_col("a"), bs_col("b"), gutters = 3)bs_row(bs_col("a"), bs_col("b"), gutters = 3)
Wraps content in a scrollable region whose nav (identified by target) is
updated as the user scrolls.
bs_scrollspy( target, ..., id = NULL, offset = NULL, smooth = TRUE, class = NULL )bs_scrollspy( target, ..., id = NULL, offset = NULL, smooth = TRUE, class = NULL )
target |
Id (without |
... |
Scrollable content and named HTML attributes. |
id |
Optional container id. The href of the currently active nav link
is reported as |
offset |
Pixels from the top to offset link activation
( |
smooth |
If |
class |
Extra classes. |
A scrollspy container tag, with the bootstrict dependency attached.
bs_scrollspy("nav-menu", shiny::tags$h4("Section"), offset = 100)bs_scrollspy("nav-menu", shiny::tags$h4("Section"), offset = 100)
Renders a native Bootstrap 5 <select class="form-select"> (selectize is
disabled to stay faithful to the Bootstrap markup).
bs_select_input( id, label = NULL, choices = NULL, selected = NULL, ..., multiple = FALSE, size = NULL, help = NULL, width = NULL )bs_select_input( id, label = NULL, choices = NULL, selected = NULL, ..., multiple = FALSE, size = NULL, help = NULL, width = NULL )
id |
Input id; value available as |
label |
Input label. |
choices |
Named or unnamed vector / list of choices. |
selected |
Initially selected value(s). |
... |
Extra attributes applied to the |
multiple |
Allow multiple selection. |
size |
Control size: |
help |
Help text rendered below the control ( |
width |
CSS width (e.g. |
A form control tag.
bs_select_input("fruit", "Fruit", c("Apple", "Pear"))bs_select_input("fruit", "Fruit", c("Apple", "Pear"))
An animated loading indicator. Render either a spinning border
(type = "border") or a pulsing dot (type = "grow"), optionally tinted
with a theme colour and shrunk to the small variant.
bs_spinner( type = c("border", "grow"), color = NULL, size = NULL, label = "Loading...", ..., class = NULL )bs_spinner( type = c("border", "grow"), color = NULL, size = NULL, label = "Loading...", ..., class = NULL )
type |
Spinner style: |
color |
Theme colour ( |
size |
Spinner size; only |
label |
Visually hidden text announced to assistive technology. |
... |
Additional named HTML attributes applied to the spinner element. |
class |
Extra classes. |
A spinner tag.
bs_spinner(type = "border", color = "primary")bs_spinner(type = "border", color = "primary")
Render a faithful Bootstrap 5 <table class="table">. Pass a data frame or
matrix in data to have the header and body built automatically from its
column names and rows; otherwise supply <thead>/<tbody> markup (or any
table children) through ....
bs_table( data = NULL, ..., striped = FALSE, bordered = FALSE, borderless = FALSE, hover = FALSE, small = FALSE, variant = NULL, responsive = FALSE, align = NULL, caption = NULL, class = NULL )bs_table( data = NULL, ..., striped = FALSE, bordered = FALSE, borderless = FALSE, hover = FALSE, small = FALSE, variant = NULL, responsive = FALSE, align = NULL, caption = NULL, class = NULL )
data |
A data frame or matrix to render. When |
... |
Manual table children (when |
striped |
Add zebra-striping to table rows ( |
bordered |
Add borders on all sides ( |
borderless |
Remove all borders ( |
hover |
Enable a hover state on rows ( |
small |
Make the table more compact ( |
variant |
Theme colour for the whole table ( |
responsive |
Make the table scroll horizontally on small devices. Use
|
align |
Vertical alignment of cells ( |
caption |
Optional table caption text rendered in a |
class |
Extra classes. |
A table tag (wrapped in a responsive container when responsive is
set).
bs_table(head(mtcars), striped = TRUE, hover = TRUE)bs_table(head(mtcars), striped = TRUE, hover = TRUE)
An interactive set of tabbed panels. The data-value of the currently
shown panel is reported to the server as input$id, and the active tab can
be driven server-side with update_bs_tabset().
bs_tabset( id, ..., type = "tabs", selected = NULL, fill = FALSE, justified = FALSE, vertical = FALSE, class = NULL ) bs_tab_panel(title, ..., value = NULL, icon = NULL, class = NULL)bs_tabset( id, ..., type = "tabs", selected = NULL, fill = FALSE, justified = FALSE, vertical = FALSE, class = NULL ) bs_tab_panel(title, ..., value = NULL, icon = NULL, class = NULL)
id |
Tabset id; the active panel value is available as |
... |
Panels built with |
type |
Visual style: |
selected |
Value of the panel shown initially (defaults to the first). |
fill |
If |
justified |
If |
vertical |
If |
class |
Extra classes for the wrapper. |
title |
Tab label content. |
value |
Panel identifier reported to the server (defaults to |
icon |
Optional icon placed before the title. |
A tabset tag.
bs_tabset( "tabs", bs_tab_panel("Home", "Home content", value = "home"), bs_tab_panel("Profile", "Profile content", value = "profile"), selected = "profile" )bs_tabset( "tabs", bs_tab_panel("Home", "Home content", value = "home"), bs_tab_panel("Profile", "Profile content", value = "profile"), selected = "profile" )
Bootstrap text input
bs_text_input( id, label = NULL, value = "", ..., placeholder = NULL, size = NULL, help = NULL, width = NULL )bs_text_input( id, label = NULL, value = "", ..., placeholder = NULL, size = NULL, help = NULL, width = NULL )
id |
Input id; value available as |
label |
Input label. |
value |
Initial value. |
... |
Extra attributes applied to the |
placeholder |
Placeholder text. |
size |
Control size: |
help |
Help text rendered below the control ( |
width |
CSS width (e.g. |
A form control tag.
bs_text_input("name", "Your name", placeholder = "Jane Doe")bs_text_input("name", "Your name", placeholder = "Jane Doe")
Bootstrap textarea input
bs_textarea_input( id, label = NULL, value = "", ..., placeholder = NULL, rows = NULL, cols = NULL, size = NULL, help = NULL, width = NULL )bs_textarea_input( id, label = NULL, value = "", ..., placeholder = NULL, rows = NULL, cols = NULL, size = NULL, help = NULL, width = NULL )
id |
Input id; value available as |
label |
Input label. |
value |
Initial value. |
... |
Extra attributes applied to the |
placeholder |
Placeholder text. |
rows, cols
|
Visible rows / columns. |
size |
Control size: |
help |
Help text rendered below the control ( |
width |
CSS width (e.g. |
A form control tag.
A lightweight, dismissible notification. The toast's visibility is reported
to the server as input$id (TRUE when shown), and can be driven
server-side with show_bs_toast() / hide_bs_toast(). Place one or more
toasts inside a bs_toast_container() to position them on screen, or push
transient notifications entirely from the server with bs_notify_toast().
bs_toast( id, ..., title = NULL, icon = NULL, autohide = TRUE, delay = 5000, animation = TRUE, class = NULL )bs_toast( id, ..., title = NULL, icon = NULL, autohide = TRUE, delay = 5000, animation = TRUE, class = NULL )
id |
Toast id; shown state available as |
... |
Toast body content and named HTML attributes applied to the root. |
title |
Optional header title. When supplied, a |
icon |
Optional icon placed before the title in the header. |
autohide |
If |
delay |
Delay in milliseconds before auto-hiding (when |
animation |
If |
class |
Extra classes. |
A toast tag.
bs_toast("hello", "Hello, world!", title = "Bootstrict")bs_toast("hello", "Hello, world!", title = "Bootstrict")
A fixed-position container that holds and lays out one or more bs_toast()s.
bs_toast_container(..., placement = "top-end", class = NULL)bs_toast_container(..., placement = "top-end", class = NULL)
... |
Toasts and named HTML attributes applied to the container. |
placement |
Where to anchor the container. One of |
class |
Extra classes. |
A toast container tag.
bs_toast_container( bs_toast("hello", "Hi there", title = "Greeting"), placement = "top-end" )bs_toast_container( bs_toast("hello", "Hi there", title = "Greeting"), placement = "top-end" )
Decorates an existing tag with the data attributes Bootstrap needs to render a tooltip. Tooltips are initialised client-side by bootstrict (Bootstrap does not auto-initialise them).
bs_tooltip(tag, title, ..., placement = "top", html = FALSE, trigger = NULL)bs_tooltip(tag, title, ..., placement = "top", html = FALSE, trigger = NULL)
tag |
A UI element (a |
title |
Tooltip text (or HTML, when |
... |
Extra named attributes applied to |
placement |
Tooltip placement: one of |
html |
If |
trigger |
How the tooltip is triggered (e.g. |
The decorated tag, with the bootstrict dependency attached.
bs_tooltip(shiny::tags$button("Hover me"), "Tooltip text")bs_tooltip(shiny::tags$button("Hover me"), "Tooltip text")
Inline messages shown next to a control to convey its validation state.
bs_valid_feedback() renders .valid-feedback; bs_invalid_feedback()
renders .invalid-feedback.
bs_valid_feedback(..., class = NULL) bs_invalid_feedback(..., class = NULL)bs_valid_feedback(..., class = NULL) bs_invalid_feedback(..., class = NULL)
... |
Feedback content and named HTML attributes. |
class |
Extra classes. |
A div tag.
bs_valid_feedback("Looks good!") bs_invalid_feedback("Please choose a username.")bs_valid_feedback("Looks good!") bs_invalid_feedback("Please choose a username.")
A vertical divider (.vr), the vertical counterpart of <hr>.
bs_vr(class = NULL)bs_vr(class = NULL)
class |
Extra classes. |
A <div> tag.
bs_vr()bs_vr()
Reads a _variables.scss style file (the kind a designer exports) and
extracts top-level $name: value; declarations into a named list suitable
for passing to bootstrict_theme() or bslib::bs_theme(). Trailing
!default / !global flags and line/block comments are stripped. Values
are returned verbatim as strings (Sass resolves them at compile time), so
maps, functions and colour expressions all pass straight through.
parse_scss_variables(path)parse_scss_variables(path)
path |
Path to a |
A named list of Sass variable values. Names use the Bootstrap
convention without the leading $ (e.g. primary, font-family-base).
tmp <- tempfile(fileext = ".scss") writeLines(c("$primary: #ff6600;", "$border-radius: 0.5rem !default;"), tmp) parse_scss_variables(tmp)tmp <- tempfile(fileext = ".scss") writeLines(c("$primary: #ff6600;", "$border-radius: 0.5rem !default;"), tmp) parse_scss_variables(tmp)
Sets the Bootstrap 5.3 colour mode (data-bs-theme) on the page body,
switching every component between light and dark. Set the initial mode
with the color_mode argument of bs_page().
set_bs_color_mode(mode, session = shiny::getDefaultReactiveDomain())set_bs_color_mode(mode, session = shiny::getDefaultReactiveDomain())
mode |
|
session |
The Shiny session. |
Invisibly NULL, called for its side effect.
if (interactive()) set_bs_color_mode("dark")if (interactive()) set_bs_color_mode("dark")
Show, hide or toggle a bs_modal() from server code.
show_bs_modal(id, session = shiny::getDefaultReactiveDomain()) hide_bs_modal(id, session = shiny::getDefaultReactiveDomain()) toggle_bs_modal(id, session = shiny::getDefaultReactiveDomain())show_bs_modal(id, session = shiny::getDefaultReactiveDomain()) hide_bs_modal(id, session = shiny::getDefaultReactiveDomain()) toggle_bs_modal(id, session = shiny::getDefaultReactiveDomain())
id |
Modal id (namespaced automatically inside modules). |
session |
The Shiny session. |
Invisibly NULL, called for its side effect.
if (interactive()) show_bs_modal("info") if (interactive()) hide_bs_modal("info") if (interactive()) toggle_bs_modal("info")if (interactive()) show_bs_modal("info") if (interactive()) hide_bs_modal("info") if (interactive()) toggle_bs_modal("info")
Show, hide or toggle a bs_offcanvas() from server code.
show_bs_offcanvas(id, session = shiny::getDefaultReactiveDomain()) hide_bs_offcanvas(id, session = shiny::getDefaultReactiveDomain()) toggle_bs_offcanvas(id, session = shiny::getDefaultReactiveDomain())show_bs_offcanvas(id, session = shiny::getDefaultReactiveDomain()) hide_bs_offcanvas(id, session = shiny::getDefaultReactiveDomain()) toggle_bs_offcanvas(id, session = shiny::getDefaultReactiveDomain())
id |
Offcanvas id (namespaced automatically inside modules). |
session |
The Shiny session. |
Invisibly NULL, called for its side effect.
if (interactive()) show_bs_offcanvas("menu") if (interactive()) hide_bs_offcanvas("menu") if (interactive()) toggle_bs_offcanvas("menu")if (interactive()) show_bs_offcanvas("menu") if (interactive()) hide_bs_offcanvas("menu") if (interactive()) toggle_bs_offcanvas("menu")
Show or hide a bs_toast() from server code.
show_bs_toast(id, session = shiny::getDefaultReactiveDomain()) hide_bs_toast(id, session = shiny::getDefaultReactiveDomain())show_bs_toast(id, session = shiny::getDefaultReactiveDomain()) hide_bs_toast(id, session = shiny::getDefaultReactiveDomain())
id |
Toast id (namespaced automatically inside modules). |
session |
The Shiny session. |
Invisibly NULL, called for its side effect.
if (interactive()) show_bs_toast("hello") if (interactive()) hide_bs_toast("hello")if (interactive()) show_bs_toast("hello") if (interactive()) hide_bs_toast("hello")
Control an accordion from the server
update_bs_accordion( id, open = NULL, close = NULL, session = shiny::getDefaultReactiveDomain() )update_bs_accordion( id, open = NULL, close = NULL, session = shiny::getDefaultReactiveDomain() )
id |
Accordion id (namespaced automatically inside modules). |
open |
Panel value(s) to open. Use |
close |
Panel value(s) to close. Use |
session |
The Shiny session. |
Invisibly NULL, called for its side effect.
Control a carousel from the server
update_bs_carousel( id, to = NULL, slide = NULL, session = shiny::getDefaultReactiveDomain() )update_bs_carousel( id, to = NULL, slide = NULL, session = shiny::getDefaultReactiveDomain() )
id |
Carousel id (namespaced automatically inside modules). |
to |
0-based index of the slide to cycle to. Takes precedence over
|
slide |
Direction to advance: |
session |
The Shiny session. |
Invisibly NULL, called for its side effect.
## Not run: update_bs_carousel("demo", to = 2) update_bs_carousel("demo", slide = "next") ## End(Not run)## Not run: update_bs_carousel("demo", to = 2) update_bs_carousel("demo", slide = "next") ## End(Not run)
Show, hide or toggle a bs_collapse() from server code.
update_bs_collapse( id, action = c("toggle", "show", "hide"), session = shiny::getDefaultReactiveDomain() )update_bs_collapse( id, action = c("toggle", "show", "hide"), session = shiny::getDefaultReactiveDomain() )
id |
Collapse id (namespaced automatically inside modules). |
action |
One of |
session |
The Shiny session. |
Invisibly NULL, called for its side effect.
if (interactive()) update_bs_collapse("more", "show")if (interactive()) update_bs_collapse("more", "show")
Routes through shiny::session's sendInputMessage() so the colour binding's
receiveMessage updates the swatch.
update_bs_color(id, value, session = shiny::getDefaultReactiveDomain())update_bs_color(id, value, session = shiny::getDefaultReactiveDomain())
id |
Colour input id (namespaced automatically inside modules). |
value |
New colour as a hex string (e.g. |
session |
The Shiny session. |
Invisibly NULL, called for its side effect.
if (interactive()) update_bs_color("col", "#198754")if (interactive()) update_bs_color("col", "#198754")
Activates the item whose value matches selected in a selectable
bs_list_group() (one created with an id).
update_bs_list_group( id, selected = NULL, session = shiny::getDefaultReactiveDomain() )update_bs_list_group( id, selected = NULL, session = shiny::getDefaultReactiveDomain() )
id |
List group id (namespaced automatically inside modules). |
selected |
Item value to activate. |
session |
The Shiny session. |
Invisibly NULL, called for its side effect.
## Not run: update_bs_list_group("my_group", selected = "two") ## End(Not run)## Not run: update_bs_list_group("my_group", selected = "two") ## End(Not run)
Update a progress bar from the server
update_bs_progress( id, value = NULL, label = NULL, color = NULL, min = NULL, max = NULL, session = shiny::getDefaultReactiveDomain() )update_bs_progress( id, value = NULL, label = NULL, color = NULL, min = NULL, max = NULL, session = shiny::getDefaultReactiveDomain() )
id |
Id of the |
value |
New value. |
label |
New text shown inside the bar. |
color |
New theme colour ( |
min, max
|
New lower / upper bounds of the scale. |
session |
The Shiny session. |
Invisibly NULL, called for its side effect.
## Not run: update_bs_progress("load", value = 80) ## End(Not run)## Not run: update_bs_progress("load", value = 80) ## End(Not run)
Routes through shiny::session's sendInputMessage() so the range binding's
receiveMessage updates the slider (the "shiny-like" update path).
update_bs_range(id, value, session = shiny::getDefaultReactiveDomain())update_bs_range(id, value, session = shiny::getDefaultReactiveDomain())
id |
Range input id (namespaced automatically inside modules). |
value |
New value. |
session |
The Shiny session. |
Invisibly NULL, called for its side effect.
if (interactive()) update_bs_range("vol", 75)if (interactive()) update_bs_range("vol", 75)
Control a tabset from the server
update_bs_tabset(id, selected, session = shiny::getDefaultReactiveDomain())update_bs_tabset(id, selected, session = shiny::getDefaultReactiveDomain())
id |
Tabset id (namespaced automatically inside modules). |
selected |
Value of the panel to show. |
session |
The Shiny session. |
Invisibly NULL, called for its side effect.
## Not run: update_bs_tabset("tabs", selected = "profile") ## End(Not run)## Not run: update_bs_tabset("tabs", selected = "profile") ## End(Not run)
Returns the bootstrict HTML dependency (Shiny input bindings + supporting
CSS) so it can be dropped anywhere in a UI. Page constructors such as
bs_page() call this for you; use it directly when embedding bootstrict
widgets into a UI you build by hand.
use_bootstrict()use_bootstrict()
A golem::create_golem() project_hook that turns a freshly created golem
skeleton into a minimal bootstrict application:
use_bootstrict_golem(path, package_name, ...)use_bootstrict_golem(path, package_name, ...)
path |
Path of the newly created golem project. Unused, kept for compatibility with the golem hook interface. |
package_name |
Name of the package / application being created. |
... |
Reserved for compatibility with the golem hook interface. |
R/app_ui.R is rewritten to use bs_page() and shows a "Hello world"
inside a bs_container().
An (empty by default) inst/app/www/_variables.scss designer variable
sheet is created and wired into bootstrict_theme(), so a designer can
drop SCSS variables ($name: value;) in and have them picked up
automatically.
golem sets the working directory to the new project before calling the hook, so every path below is relative to the application root.
Invisibly NULL. Called for its side effects on the project files.
if (interactive()) { golem::create_golem( "my.app", project_hook = bootstrict::use_bootstrict_golem ) }if (interactive()) { golem::create_golem( "my.app", project_hook = bootstrict::use_bootstrict_golem ) }