| 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. Bootstrap 5.3 itself is vendored and compiled with 'sass', so a designer-provided SASS variable sheet composes natively and the Bootstrap version reaching the browser is fixed by this package. |
| Authors: | Colin Fay [aut, cre] |
| Maintainer: | Colin Fay <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.9.9.9000 |
| Built: | 2026-10-15 11:08:19 UTC |
| Source: | https://github.com/ThinkR-open/bootstrict |
Compiles theme against the vendored Bootstrap SASS tree and returns the
resulting stylesheet together with Bootstrap's JavaScript bundle. The
dependency is named "bootstrap" at the vendored version, so it supersedes
the Bootstrap 3 stylesheet Shiny's own page functions attach.
bootstrap_dep(theme = bootstrict_theme())bootstrap_dep(theme = bootstrict_theme())
theme |
bs_page() and friends call this for you; use it directly when building a
page by hand. Compiled stylesheets are cached per theme for the session.
if (interactive()) { bootstrap_dep(bootstrict_theme(primary = "#ff6600")) }if (interactive()) { bootstrap_dep(bootstrict_theme(primary = "#ff6600")) }
bootstrict vendors its own copy of Bootstrap under inst/lib/bootstrap
rather than compiling against whatever version a theming package happens to
bundle, so this is the version that actually reaches the browser.
bootstrap_version()bootstrap_version()
The Bootstrap version, as a string.
bootstrap_version()bootstrap_version()
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()
bootstrict_dep()bootstrict_dep()
Collects SASS variable overrides – from a designer's exported sheet, from
..., or both – for bootstrap_dep() to compile against the Bootstrap
tree bootstrict vendors. Variables from variables are merged with (and
overridden by) any passed through ....
bootstrict_theme(..., variables = NULL)bootstrict_theme(..., variables = NULL)
... |
Named SASS variables, e.g. |
variables |
Optional path to a |
Values are placed in the SASS layer that can actually compile them. A value
built only from literals or from the sheet's own variables ($primary: #ff6600, $link-color: $primary) goes to the defaults layer, where it is
set before Bootstrap derives $theme-colors and the rest from it. A value
referring to one of Bootstrap's own variables ($link-hover-color: shade-color($primary, 20%), with no $primary in the sheet) cannot go
there – Bootstrap's variables are not defined yet – so it goes to the
declarations layer, after the configuration block.
One consequence is worth knowing: a theme colour redefined from one of
Bootstrap's own variables ($secondary: $gray-600) lands in the
declarations layer, after $theme-colors has been built, so it will not
restyle .btn-secondary. Give the sheet its own literal (or define the
variable it refers to) when that matters.
A bootstrict_theme object.
bootstrict_theme(primary = "#ff6600", "font-size-base" = "1rem")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" )
Given an id, a dismissible alert reports whether it is still on the page
as input$id (TRUE until it is dismissed, FALSE once it is) and can be
closed from the server with close_bs_alert().
bs_alert(..., id = NULL, color = "primary", dismissible = FALSE, class = NULL) bs_alert_heading(..., level = 4, class = NULL) bs_alert_link(..., href = "#", class = NULL)bs_alert(..., id = NULL, 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. |
id |
Optional alert id. Its visibility is reported as |
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( bs_alert_heading("Well done"), "You read ", bs_alert_link("the docs", href = "#"), ".", color = "success" )bs_alert("Well done!", color = "success") bs_alert("Heads up.", color = "warning", dismissible = TRUE) bs_alert( bs_alert_heading("Well done"), "You read ", bs_alert_link("the docs", href = "#"), ".", color = "success" )
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_toolbar( bs_button_group(bs_button(label = "Cut")), bs_button_group(bs_button(label = "Copy")) )bs_button_group(bs_button(label = "Left"), bs_button(label = "Right")) bs_button_toolbar( bs_button_group(bs_button(label = "Cut")), bs_button_group(bs_button(label = "Copy")) )
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 = "", ..., 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 = "", ..., 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_group( bs_card( bs_card_img("cap.png", alt = ""), bs_card_body( bs_card_title("Title"), bs_card_subtitle("Subtitle"), bs_card_link("More", href = "#") ), bs_card_footer("2 days ago") ) ) bs_card(bs_card_img("cap.png", alt = ""), bs_card_img_overlay("Over"))bs_card( bs_card_header("Featured"), bs_card_body( bs_card_title("Card title"), bs_card_text("Some quick example text.") ) ) bs_card_group( bs_card( bs_card_img("cap.png", alt = ""), bs_card_body( bs_card_title("Title"), bs_card_subtitle("Subtitle"), bs_card_link("More", href = "#") ), bs_card_footer("2 days ago") ) ) bs_card(bs_card_img("cap.png", alt = ""), bs_card_img_overlay("Over"))
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, wrap = TRUE, keyboard = TRUE, pause = "hover", touch = TRUE, 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, wrap = TRUE, keyboard = TRUE, pause = "hover", touch = TRUE, 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 |
|
interval |
Cycling interval in milliseconds (sets |
wrap |
If |
keyboard |
If |
pause |
|
touch |
If |
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_switch_input("dark", "Dark mode") bs_checkbox_input("dark", "Dark mode", switch = TRUE)bs_checkbox_input("agree", "I agree", TRUE) bs_switch_input("dark", "Dark mode") 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.
bs_close_button() bs_close_button(`data-bs-dismiss` = "alert", white = TRUE)bs_close_button() bs_close_button(`data-bs-dismiss` = "alert", white = TRUE)
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")))
A native <input type="date"> with the Bootstrap .form-control class, as
the Bootstrap 5.3 forms reference has it: the browser supplies the calendar.
bs_date_input( id, label = NULL, value = NULL, ..., min = NULL, max = NULL, size = NULL, help = NULL, width = NULL )bs_date_input( id, label = NULL, value = NULL, ..., min = NULL, max = NULL, size = 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
|
Earliest / latest selectable date. |
size |
Control size: |
help |
Help text rendered below the control ( |
width |
CSS width (e.g. |
This does not delegate to shiny::dateInput(), which loads
bootstrap-datepicker – a third-party stylesheet whose calendar markup
(.datepicker, .datepicker-days, ...) appears nowhere in the Bootstrap
documentation and which a designer's SASS sheet cannot reach. The
consequence is that format, language, weekstart and datesdisabled
are gone: the browser owns the presentation, and there is no Bootstrap way
to ask it for another. Use update_bs_date_input() rather than
shiny::updateDateInput().
A form control tag.
update_bs_date_input(), bs_date_range_input()
bs_date_input("day", "Pick a day", value = "2026-06-26")bs_date_input("day", "Pick a day", value = "2026-06-26")
Two native date fields joined in an .input-group, with a separator
between them. Bootstrap has no date-range component, so this is the
assembly its docs prescribe; see bs_date_input() for why neither field
delegates to shiny.
bs_date_range_input( id, label = NULL, start = NULL, end = NULL, ..., min = NULL, max = NULL, separator = "to", size = NULL, help = NULL, width = NULL )bs_date_range_input( id, label = NULL, start = NULL, end = NULL, ..., min = NULL, max = NULL, separator = "to", size = 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
|
Earliest / latest selectable date. |
separator |
Text shown between the two fields, in an
|
size |
Control size: |
help |
Help text rendered below the control ( |
width |
CSS width (e.g. |
A form control tag. input$id is a length-2 Date.
update_bs_date_range_input(), bs_date_input()
bs_date_range_input("range", "Period", start = "2026-01-01")bs_date_range_input("range", "Period", start = "2026-01-01")
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)
Delegates to shiny::downloadButton() and adapts its markup to Bootstrap 5.
bs_download_button( id, label = "Download", ..., icon = NULL, color = "primary", outline = FALSE, size = NULL, class = NULL )bs_download_button( id, label = "Download", ..., icon = NULL, color = "primary", outline = FALSE, size = NULL, class = NULL )
id |
Output id, matching the |
label |
Button label (text or tags). |
... |
Additional content and named HTML attributes, forwarded to the anchor. |
icon |
Optional icon tag placed before the label. |
color |
One of the eight Bootstrap theme colours, or |
outline |
If |
size |
|
class |
Extra classes. |
shiny hardcodes class = "btn btn-default shiny-download-link".
.btn-default is a Bootstrap 3 class with no Bootstrap 5 equivalent, so the
button renders with the .btn box but no colour, border or hover state. We
drop it and substitute a real 5.3 variant (.btn-primary,
.btn-outline-secondary, ...), matching bs_button()'s API.
Everything else is left to shiny: the shiny-download-link class, the
href / target / download attributes and the auto-enable dance (the
anchor ships .disabled + aria-disabled and shiny's client enables it once
the matching shiny::downloadHandler() is registered) are untouched, so
output$id <- downloadHandler(...) works exactly as usual.
Unlike shiny, icon defaults to NULL: shiny's default is a Font Awesome
icon, which is outside Bootstrap 5 and therefore outside this package.
An anchor tag styled as a Bootstrap button.
shiny::downloadHandler(), bs_download_link(), bs_button()
bs_download_button("report", "Download CSV") bs_download_button("report", "Export", color = "secondary", outline = TRUE)bs_download_button("report", "Download CSV") bs_download_button("report", "Export", color = "secondary", outline = TRUE)
Delegates to shiny::downloadLink(), the plain-text counterpart of
bs_download_button(). shiny's markup is already Bootstrap-5 clean here (no
.btn-default), so this only layers on the 5.3 link utilities: color
emits a .link-* colour class.
bs_download_link(id, label = "Download", ..., color = NULL, class = NULL)bs_download_link(id, label = "Download", ..., color = NULL, class = NULL)
id |
Output id, matching the |
label |
Button label (text or tags). |
... |
Additional content and named HTML attributes, forwarded to the anchor. |
color |
Optional theme colour, rendered as |
class |
Extra classes. |
An anchor tag.
shiny::downloadHandler(), bs_download_button()
bs_download_link("report", "Download the raw data") bs_download_link("report", "Export", color = "danger")bs_download_link("report", "Download the raw data") bs_download_link("report", "Export", color = "danger")
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, ..., id = NULL, color = "secondary", outline = FALSE, size = NULL, split = FALSE, direction = "down", dark = FALSE, align = NULL, auto_close = TRUE, offset = NULL, reference = 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, ..., id = NULL, color = "secondary", outline = FALSE, size = NULL, split = FALSE, direction = "down", dark = FALSE, align = NULL, auto_close = TRUE, offset = NULL, reference = 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). |
id |
Optional input id. When set, the item becomes a Shiny action
button and its click count is reported as |
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. |
auto_close |
When the menu closes on its own: |
offset |
Menu offset from its toggle, as |
reference |
What the menu is positioned against: Bootstrap reads all three from the toggle, not from the wrapper, which
is why they are arguments rather than something to pass through |
class |
Extra classes for the wrapper. |
href |
Link target. |
active |
If |
disabled |
If |
level |
Heading level (1-6) for the dropdown header. |
Give the dropdown itself an id and its open state is reported as
input$id (TRUE while the menu is open), and it can be driven from the
server with show_bs_dropdown(), hide_bs_dropdown() and
toggle_bs_dropdown().
A dropdown tag.
show_bs_dropdown(), bs_nav_dropdown()
bs_dropdown("Menu", bs_dropdown_item("Action", id = "act")) bs_dropdown( "Menu", bs_dropdown_header("Actions"), bs_dropdown_item("Edit", id = "edit"), bs_dropdown_divider(), bs_dropdown_text("Signed in as Colin") )bs_dropdown("Menu", bs_dropdown_item("Action", id = "act")) bs_dropdown( "Menu", bs_dropdown_header("Actions"), bs_dropdown_item("Edit", id = "edit"), bs_dropdown_divider(), bs_dropdown_text("Signed in as Colin") )
Bootstrap only shows a .valid-feedback / .invalid-feedback message when
it is a following sibling of the control carrying .is-valid /
.is-invalid. A feedback div placed after a bs_*_input() is a sibling of
shiny's input container, not of the control inside it, so it would never
display. bs_feedback() inserts the messages in the right place, whatever
the control's internal structure, and is the supported way to validate a
bootstrict input.
bs_feedback(input, valid = NULL, invalid = NULL, state = NULL)bs_feedback(input, valid = NULL, invalid = NULL, state = NULL)
input |
A control tag tree produced by a |
valid |
Message shown when the control is valid, or |
invalid |
Message shown when the control is invalid, or |
state |
Initial state: |
Declare the messages in the UI and switch the state from the server with
set_bs_validation().
The input, with the feedback messages attached.
set_bs_validation(), bs_valid_feedback()
bs_feedback( bs_text_input("user", "Username"), invalid = "Please choose a username." )bs_feedback( bs_text_input("user", "Username"), invalid = "Please choose a username." )
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 = "", class = NULL) bs_figure_caption(..., class = NULL)bs_figure(..., class = NULL) bs_figure_img(src, ..., alt = "", 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. Defaults to |
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() for the upload plumbing, then emits the
Bootstrap 5.3 markup: a plain <input class="form-control" type="file">.
bs_file_input( id, label = NULL, ..., multiple = FALSE, accept = NULL, size = NULL, help = NULL, width = NULL )bs_file_input( id, label = NULL, ..., multiple = FALSE, accept = NULL, size = NULL, help = NULL, 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. |
size |
Control size: |
help |
Help text rendered below the control ( |
width |
CSS width (e.g. |
shiny builds the Bootstrap 3 compound widget instead – a "Browse" button
next to a readonly text box showing the file name, with the real input
hidden off-screen – which is not in the Bootstrap 5.3 docs at all. Only
shiny's own element is kept, so uploads, the progress bar and
input$id are unchanged; the browser draws the button and the file name
itself, which is what the 5.3 reference relies on.
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 = "", class = NULL )bs_img( src, ..., fluid = FALSE, thumbnail = FALSE, rounded = FALSE, object_fit = NULL, alt = "", 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. Defaults to |
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") # Or compose the dialog yourself. bs_modal( "info", bs_modal_header(bs_modal_title("Heads up")), bs_modal_body("Modal body text."), bs_modal_footer(bs_button("ok", "OK", color = "primary")) )bs_modal("info", "Modal body text.", title = "Heads up") # Or compose the dialog yourself. bs_modal( "info", bs_modal_header(bs_modal_title("Heads up")), bs_modal_body("Modal body text."), bs_modal_footer(bs_button("ok", "OK", color = "primary")) )
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.
bs_numeric_input("n", "How many?", value = 1, min = 0, max = 10)bs_numeric_input("n", "How many?", value = 1, min = 0, max = 10)
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")
Shiny's page constructors wired to the Bootstrap bootstrict vendors, the bootstrict dependency and a 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"))) ) bs_page_fluid(bs_container("Full width", fluid = TRUE)) bs_page_fillable(bs_container("Fills the viewport")) }if (interactive()) { bs_page( theme = bootstrict_theme(primary = "#ff6600"), bs_container(bs_card(bs_card_body("Hello"))) ) bs_page_fluid(bs_container("Full width", fluid = TRUE)) bs_page_fillable(bs_container("Fills the viewport")) }
A single <li class="page-item"> carrying a .page-link anchor. Use inside
bs_pagination().
bs_page_item( ..., value = NULL, href = "#", active = FALSE, disabled = FALSE, class = NULL )bs_page_item( ..., value = NULL, href = "#", active = FALSE, disabled = FALSE, class = NULL )
... |
Link content (text or tags) and named HTML attributes applied to
the |
value |
Value reported as |
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( ..., id = NULL, size = NULL, align = NULL, label = "Page navigation", class = NULL )bs_pagination( ..., id = NULL, size = NULL, align = NULL, label = "Page navigation", class = NULL )
... |
Page items built with |
id |
Optional pager id. The active item's |
size |
Size modifier: |
align |
Horizontal alignment of the pager: |
label |
Accessible label for the surrounding |
class |
Extra classes for the |
Given an id, the pager reports the value of the active item as
input$id and is driven from the server with update_bs_pagination().
Clicking an item makes it active without leaving the page, so the pager
drives the app rather than a URL.
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, ..., id = NULL, href_template = NULL, size = NULL, align = NULL, label = "Page navigation", class = NULL )bs_pagination_numbered( n, current = 1, ..., id = NULL, 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 |
id |
Optional pager id. The active page number is reported as
|
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.
bs_password_input("pw", "Password", help = "At least 8 characters.")bs_password_input("pw", "Password", help = "At least 8 characters.")
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_wave(bs_placeholder(width = 4))bs_placeholder_glow(bs_placeholder(width = 6)) bs_placeholder_wave(bs_placeholder(width = 4))
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). A tag that is already a data-API trigger — a
bs_modal_trigger(), bs_offcanvas_trigger(), bs_collapse_trigger() or a
dropdown toggle — keeps its own data-bs-toggle; the popover works
alongside it.
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: |
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)
The segmented control from the Bootstrap "Button group" page: a row of
buttons backed by hidden radio or checkbox inputs (.btn-check).
bs_radio_button_input() picks one value, bs_checkbox_button_input() picks
any number.
bs_radio_button_input( id, label = NULL, choices, selected = NULL, ..., color = "primary", outline = TRUE, size = NULL, vertical = FALSE, class = NULL ) bs_checkbox_button_input( id, label = NULL, choices, selected = NULL, ..., color = "primary", outline = TRUE, size = NULL, vertical = FALSE, class = NULL )bs_radio_button_input( id, label = NULL, choices, selected = NULL, ..., color = "primary", outline = TRUE, size = NULL, vertical = FALSE, class = NULL ) bs_checkbox_button_input( id, label = NULL, choices, selected = NULL, ..., color = "primary", outline = TRUE, size = NULL, vertical = FALSE, class = NULL )
id |
Input id; the selection is available as |
label |
Label shown above the group, or |
choices |
Character vector of values. Names, when present, are used as the button labels. |
selected |
Initially selected value(s). Defaults to the first choice for radio buttons and to none for checkboxes. |
... |
Named HTML attributes applied to the |
color |
Button theme colour. |
outline |
If |
size |
Button size: |
vertical |
If |
class |
Extra classes for the |
These are native controls, not restyled shiny inputs, so drive them with
update_bs_toggle_buttons() rather than shiny::updateRadioButtons().
A form control tag.
update_bs_toggle_buttons(), bs_button_group()
bs_radio_button_input("size", "Size", c(Small = "s", Large = "l")) bs_checkbox_button_input("opts", "Options", c("a", "b"))bs_radio_button_input("size", "Size", c(Small = "s", Large = "l")) bs_checkbox_button_input("opts", "Options", c("a", "b"))
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, root_margin = NULL, threshold = NULL, smooth = TRUE, class = NULL )bs_scrollspy( target, ..., id = NULL, offset = NULL, root_margin = NULL, threshold = 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
( |
root_margin |
The observer's root margin ( |
threshold |
Visibility ratios at which a section becomes active
( |
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, caption_top = FALSE, head_variant = NULL, group_divider = FALSE, row_variant = NULL, rownames = 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, caption_top = FALSE, head_variant = NULL, group_divider = FALSE, row_variant = NULL, rownames = NULL, class = NULL )
data |
A data frame or matrix to render. When |
... |
Manual table children (when |
striped |
Zebra-striping: |
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 |
caption_top |
If |
head_variant |
Theme colour for the generated |
group_divider |
If |
row_variant |
Per-row theme colour for the generated rows
( |
rownames |
Render each row's name as the reference |
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.
bs_textarea_input("bio", "Bio", rows = 3, placeholder = "A few words")bs_textarea_input("bio", "Bio", rows = 3, placeholder = "A few words")
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). A tag that is already a data-API trigger — a
bs_modal_trigger(), bs_offcanvas_trigger(), bs_collapse_trigger() or a
dropdown toggle — keeps its own data-bs-toggle; the tooltip works
alongside it.
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: |
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()
Dismisses the bs_alert() registered under id, exactly as its close
button does. Bootstrap removes the element, so the alert cannot be brought
back: render it from a renderUI() if it has to come and go.
close_bs_alert(id, session = shiny::getDefaultReactiveDomain())close_bs_alert(id, session = shiny::getDefaultReactiveDomain())
id |
Alert id, as passed to |
session |
The Shiny session. |
Nothing, called for its side effect.
if (interactive()) close_bs_alert("saved")if (interactive()) close_bs_alert("saved")
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(). 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 |
The file is scanned rather than read line by line, so a declaration may
span as many lines as it likes ($theme-colors, $grid-breakpoints and
$spacers always do), and a ;, // or /* */ inside a quoted string or
an unquoted url() is read as data. Anything that is not a top-level
variable declaration — @use/@import, a rule block — is ignored. A final
declaration with no trailing ; is still read.
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 document root,
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. |
A choice is remembered in the browser's localStorage, so it survives a
reload; "auto" forgets it and follows the operating system again. The
mode actually in force is reported as input$bootstrict_color_mode, which
is "light" or "dark" even when the preference is "auto".
Invisibly NULL, called for its side effect.
if (interactive()) set_bs_color_mode("dark")if (interactive()) set_bs_color_mode("dark")
Toggles .is-valid / .is-invalid on the control registered under id and,
when message is supplied, replaces the text of the matching feedback
message declared with bs_feedback().
set_bs_validation( id, state = c("valid", "invalid", "none"), message = NULL, session = shiny::getDefaultReactiveDomain() )set_bs_validation( id, state = c("valid", "invalid", "none"), message = NULL, session = shiny::getDefaultReactiveDomain() )
id |
Input id, as passed to the |
state |
|
message |
Optional replacement text for the feedback message. Plain
text: it is set with |
session |
The Shiny session. |
Nothing, called for its side effect.
if (interactive()) { set_bs_validation("user", "invalid", "That name is taken.") }if (interactive()) { set_bs_validation("user", "invalid", "That name is taken.") }
Drives the bs_dropdown() or bs_nav_dropdown() registered under id.
Its open state is reported back as input$id.
show_bs_dropdown(id, session = shiny::getDefaultReactiveDomain()) hide_bs_dropdown(id, session = shiny::getDefaultReactiveDomain()) toggle_bs_dropdown(id, session = shiny::getDefaultReactiveDomain())show_bs_dropdown(id, session = shiny::getDefaultReactiveDomain()) hide_bs_dropdown(id, session = shiny::getDefaultReactiveDomain()) toggle_bs_dropdown(id, session = shiny::getDefaultReactiveDomain())
id |
Dropdown id. |
session |
The Shiny session. |
Nothing, called for their side effect.
if (interactive()) { show_bs_dropdown("menu") hide_bs_dropdown("menu") toggle_bs_dropdown("menu") }if (interactive()) { show_bs_dropdown("menu") hide_bs_dropdown("menu") toggle_bs_dropdown("menu") }
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.
if (interactive()) { update_bs_accordion("acc", open = "two") update_bs_accordion("acc", close = TRUE) }if (interactive()) { update_bs_accordion("acc", open = "two") update_bs_accordion("acc", close = TRUE) }
Control a carousel from the server
update_bs_carousel( id, to = NULL, slide = NULL, action = NULL, session = shiny::getDefaultReactiveDomain() )update_bs_carousel( id, to = NULL, slide = NULL, action = 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: |
action |
|
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")
The native counterpart of shiny::updateDateInput(), which cannot reach
these controls.
update_bs_date_input( id, value = NULL, min = NULL, max = NULL, session = shiny::getDefaultReactiveDomain() ) update_bs_date_range_input( id, start = NULL, end = NULL, min = NULL, max = NULL, session = shiny::getDefaultReactiveDomain() )update_bs_date_input( id, value = NULL, min = NULL, max = NULL, session = shiny::getDefaultReactiveDomain() ) update_bs_date_range_input( id, start = NULL, end = NULL, min = NULL, max = NULL, session = shiny::getDefaultReactiveDomain() )
id |
Input id. |
value |
New date, or |
min, max
|
New bounds. |
session |
The Shiny session. |
start, end
|
New start / end dates, or |
Nothing, called for its side effect.
if (interactive()) update_bs_date_input("day", value = Sys.Date())if (interactive()) update_bs_date_input("day", value = Sys.Date())
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") update_bs_list_group("my_group", selected = character(0)) # clear ## End(Not run)## Not run: update_bs_list_group("my_group", selected = "two") update_bs_list_group("my_group", selected = character(0)) # clear ## End(Not run)
Activates the bs_page_item() carrying selected as its value inside the
bs_pagination() registered under id, and reports the change back as
input$id.
update_bs_pagination( id, selected = NULL, session = shiny::getDefaultReactiveDomain() )update_bs_pagination( id, selected = NULL, session = shiny::getDefaultReactiveDomain() )
id |
Pager id, as passed to |
selected |
|
session |
The Shiny session. |
Nothing, called for its side effect.
if (interactive()) update_bs_pagination("pager", selected = "3")if (interactive()) update_bs_pagination("pager", selected = "3")
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)
Drives a bs_radio_button_input() or bs_checkbox_button_input(). Pass
character(0) to clear a checkbox group.
update_bs_toggle_buttons( id, selected = NULL, session = shiny::getDefaultReactiveDomain() )update_bs_toggle_buttons( id, selected = NULL, session = shiny::getDefaultReactiveDomain() )
id |
Input id. |
selected |
Value(s) to select. A radio group keeps only the first. |
session |
The Shiny session. |
Nothing, called for its side effect.
if (interactive()) update_bs_toggle_buttons("size", selected = "l")if (interactive()) update_bs_toggle_buttons("size", selected = "l")
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()
shiny::fluidPage(use_bootstrict(), bs_card(bs_card_body("Hello")))shiny::fluidPage(use_bootstrict(), bs_card(bs_card_body("Hello")))
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 ) }