| Title: | Old School 'Bootstrap 4' Template for Shiny |
|---|---|
| Description: | This template is made for people having nostalgic feelings about floppy disks and other lovely stuff from that time. It is built on top of the Bootstrap 386 template <https://github.com/kristopolous/BOOTSTRA.386>. Less distraction for more productivity! |
| Authors: | David Granjon [aut, cre] |
| Maintainer: | David Granjon <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.1.9000 |
| Built: | 2026-05-28 09:00:34 UTC |
| Source: | https://github.com/RinteRface/shiny386 |
Create a Bootstrap 386 badge
badge_386(..., status, rounded = FALSE)badge_386(..., status, rounded = FALSE)
... |
Text. |
status |
Badge status. |
rounded |
Rounded style. Default to FALSE. |
A shiny tags
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( badge_386(status = "danger", "1"), badge_386(status = "info", "2"), badge_386(status = "success", "3", rounded = TRUE) ) server <- function(input, output, session) {} shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( badge_386(status = "danger", "1"), badge_386(status = "info", "2"), badge_386(status = "success", "3", rounded = TRUE) ) server <- function(input, output, session) {} shinyApp(ui, server) }
Bootstrap 386 action button
button_386(inputId, label, status = NULL, icon = NULL, width = NULL, ...)button_386(inputId, label, status = NULL, icon = NULL, width = NULL, ...)
inputId |
The |
label |
The contents of the button or link–usually a text label, but you could also use any other HTML, like an image. |
status |
Button color. |
icon |
An optional |
width |
The width of the input, e.g. |
... |
Named attributes to be applied to the button or link. |
A shiny tag.
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( button_386( "btn", HTML(paste("Value", textOutput("val"), sep = ":")), icon = icon("thumbs-up"), class = "btn-lg" ) ) server <- function(input, output) { output$val <- renderText(input$btn) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( button_386( "btn", HTML(paste("Value", textOutput("val"), sep = ":")), icon = icon("thumbs-up"), class = "btn-lg" ) ) server <- function(input, output) { output$val <- renderText(input$btn) } shinyApp(ui, server) }
Create a Bootstrap 386 card
Create a Bootstrap 4 card title element
Create a Bootstrap 386 card subtitle element
Create a Bootstrap 386 card link element
card_386(..., title = NULL, status = NULL, footer = NULL) card_title_386(title) card_subtitle_386(subtitle) card_link_386(href, label)card_386(..., title = NULL, status = NULL, footer = NULL) card_title_386(title) card_subtitle_386(subtitle) card_link_386(href, label)
... |
Card content. |
title |
Title text. |
status |
Card background status. |
footer |
Card footer. |
subtitle |
Card subtitle. |
href |
Target url. |
label |
Link text. |
A shiny tag
A shiny tag.
A shiny tag.
A shiny tag.
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( card_386( title = "My card", "This is my card", br(), card_link_386(href = "https://www.google.com", "More"), footer = "Card footer" ) ) server <- function(input, output, session) {} shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( card_386( title = "My card", "This is my card", br(), card_link_386(href = "https://www.google.com", "More"), footer = "Card footer" ) ) server <- function(input, output, session) {} shinyApp(ui, server) }
Create a Bootstrap 386 checkbox group input
checkbox_group_input_386( inputId, label, choices = NULL, selected = NULL, width = NULL, choiceNames = NULL, choiceValues = NULL )checkbox_group_input_386( inputId, label, choices = NULL, selected = NULL, width = NULL, choiceNames = NULL, choiceValues = NULL )
inputId |
The |
label |
Display label for the control, or |
choices |
List of values to show checkboxes for. If elements of the list
are named then that name rather than the value is displayed to the user. If
this argument is provided, then |
selected |
The values that should be initially selected, if any. |
width |
The width of the input, e.g. |
choiceNames, choiceValues
|
List of names and values, respectively,
that are displayed to the user in the app and correspond to the each
choice (for this reason, |
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( checkbox_group_input_386("variable", "Variables to show:", c("Cylinders" = "cyl", "Transmission" = "am", "Gears" = "gear")), tableOutput("data") ) server <- function(input, output, session) { output$data <- renderTable({ mtcars[, c("mpg", input$variable), drop = FALSE] }, rownames = TRUE) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( checkbox_group_input_386("variable", "Variables to show:", c("Cylinders" = "cyl", "Transmission" = "am", "Gears" = "gear")), tableOutput("data") ) server <- function(input, output, session) { output$data <- renderTable({ mtcars[, c("mpg", input$variable), drop = FALSE] }, rownames = TRUE) } shinyApp(ui, server) }
Create a Bootstrap 386 checkbox
checkbox_input_386(inputId, label, value = FALSE, width = NULL)checkbox_input_386(inputId, label, value = FALSE, width = NULL)
inputId |
The |
label |
Display label for the control, or |
value |
Initial value ( |
width |
The width of the input, e.g. |
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( checkbox_input_386("check", "Check me", TRUE), verbatimTextOutput("val") ) server <- function(input, output, session) { output$val <- renderPrint(input$check) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( checkbox_input_386("check", "Check me", TRUE), verbatimTextOutput("val") ) server <- function(input, output, session) { output$val <- renderPrint(input$check) } shinyApp(ui, server) }
Used internally by toggle_input_386 and checkbox_input_386
create_checkbox_tag( inputId, label, value = FALSE, width = NULL, type = c("switch", "checkbox") )create_checkbox_tag( inputId, label, value = FALSE, width = NULL, type = c("switch", "checkbox") )
inputId |
The |
label |
Display label for the control, or |
value |
Initial value ( |
width |
The width of the input, e.g. |
type |
Input type. This is to be able to distinguish between switch and checkbox, which have slightly different design. |
An input tag.
Can be a simple link or an action button
dropdown_386(..., inputId = NULL, label, status = NULL, open = FALSE) open_dropdown_386(inputId, session = shiny::getDefaultReactiveDomain()) dropdown_item_386(inputId = NULL, href = NULL, label)dropdown_386(..., inputId = NULL, label, status = NULL, open = FALSE) open_dropdown_386(inputId, session = shiny::getDefaultReactiveDomain()) dropdown_item_386(inputId = NULL, href = NULL, label)
... |
Slot for dropdown_item_386. |
inputId |
If action button. |
label |
Button label. |
status |
Button status. |
open |
Whether to open the dropdown at start. Default to FALSE. |
session |
Shiny session object. |
href |
If simple link. |
A shiny tag
A message from R to JavaScript through the websocket.
A shiny tag
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( dropdown_386( inputId = "plop", label = "Menu", status = "danger", open = FALSE, dropdown_item_386(inputId = "btn1", label = "button 1"), dropdown_item_386(href = "https://www.google.com/", label = "More") ) ) server <- function(input, output, session) { observe(print(input$btn1)) } shinyApp(ui, server) } if (interactive()) { library(shiny) library(shiny386) ui <- page_386( fluidRow( button_386("open", "Open dropdown", class = "btn-lg"), dropdown_386( inputId = "plop", label = "Menu", dropdown_item_386(inputId = "btn1", label = "button 1"), dropdown_item_386(href = "https://www.google.com/", label = "More") ) ) ) server <- function(input, output, session) { observe(print(input$plop)) observeEvent(input$open, { open_dropdown_386("plop") }) observeEvent(req(input$plop), { showNotification("Dropdown opened!") }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( dropdown_386( inputId = "plop", label = "Menu", status = "danger", open = FALSE, dropdown_item_386(inputId = "btn1", label = "button 1"), dropdown_item_386(href = "https://www.google.com/", label = "More") ) ) server <- function(input, output, session) { observe(print(input$btn1)) } shinyApp(ui, server) } if (interactive()) { library(shiny) library(shiny386) ui <- page_386( fluidRow( button_386("open", "Open dropdown", class = "btn-lg"), dropdown_386( inputId = "plop", label = "Menu", dropdown_item_386(inputId = "btn1", label = "button 1"), dropdown_item_386(href = "https://www.google.com/", label = "More") ) ) ) server <- function(input, output, session) { observe(print(input$plop)) observeEvent(input$open, { open_dropdown_386("plop") }) observeEvent(req(input$plop), { showNotification("Dropdown opened!") }) } shinyApp(ui, server) }
Create a Bootstrap 386 Jumbotron
jumbotron_386(..., title = NULL)jumbotron_386(..., title = NULL)
... |
Any element. |
title |
Jumbotron title. |
A shiny tag
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( jumbotron_386( title = "Jumbotron 386", p("Hello World"), button_386("btn", "More", class = "btn-lg btn-block") ) ) server <- function(input, output, session) {} shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( jumbotron_386( title = "Jumbotron 386", p("Hello World"), button_386("btn", "More", class = "btn-lg btn-block") ) ) server <- function(input, output, session) {} shinyApp(ui, server) }
Create a Bootstrap 386 list group container
list_group_386(..., width = 4)list_group_386(..., width = 4)
... |
Slot for list_group_item_386. |
width |
List group width. 4 by default. Between 1 and 12. |
David Granjon, [email protected]
if(interactive()){ library(shiny) library(shiny386) shinyApp( ui = page_386( fluidRow( list_group_386( list_group_item_386( type = "basic", "Cras justo odio" ), list_group_item_386( type = "basic", "Dapibus ac facilisis in" ), list_group_item_386( type = "basic", "Morbi leo risus" ) ), list_group_386( list_group_item_386( "Cras justo odio", active = TRUE, disabled = FALSE, type = "action", src = "http://www.google.fr" ), list_group_item_386( active = FALSE, disabled = FALSE, type = "action", "Dapibus ac facilisis in", src = "http://www.google.fr" ), list_group_item_386( "Morbi leo risus", active = FALSE, disabled = TRUE, type = "action", src = "http://www.google.fr" ) ), list_group_386( list_group_item_386( "Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.", active = TRUE, disabled = FALSE, type = "heading", title = "List group item heading", subtitle = "3 days ago", footer = "Donec id elit non mi porta." ), list_group_item_386( "Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.", active = FALSE, disabled = FALSE, type = "heading", title = "List group item heading", subtitle = "3 days ago", footer = "Donec id elit non mi porta." ) ) ) ), server = function(input, output) {} ) }if(interactive()){ library(shiny) library(shiny386) shinyApp( ui = page_386( fluidRow( list_group_386( list_group_item_386( type = "basic", "Cras justo odio" ), list_group_item_386( type = "basic", "Dapibus ac facilisis in" ), list_group_item_386( type = "basic", "Morbi leo risus" ) ), list_group_386( list_group_item_386( "Cras justo odio", active = TRUE, disabled = FALSE, type = "action", src = "http://www.google.fr" ), list_group_item_386( active = FALSE, disabled = FALSE, type = "action", "Dapibus ac facilisis in", src = "http://www.google.fr" ), list_group_item_386( "Morbi leo risus", active = FALSE, disabled = TRUE, type = "action", src = "http://www.google.fr" ) ), list_group_386( list_group_item_386( "Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.", active = TRUE, disabled = FALSE, type = "heading", title = "List group item heading", subtitle = "3 days ago", footer = "Donec id elit non mi porta." ), list_group_item_386( "Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.", active = FALSE, disabled = FALSE, type = "heading", title = "List group item heading", subtitle = "3 days ago", footer = "Donec id elit non mi porta." ) ) ) ), server = function(input, output) {} ) }
Create a Bootstrap 386 list group item
list_group_item_386( ..., active = FALSE, disabled = FALSE, type = c("basic", "action", "heading"), src = "#", title = NULL, subtitle = NULL, footer = NULL )list_group_item_386( ..., active = FALSE, disabled = FALSE, type = c("basic", "action", "heading"), src = "#", title = NULL, subtitle = NULL, footer = NULL )
... |
Item content. |
active |
Whether the item is active or not. FALSE by default. Only if type is "action" or "heading". |
disabled |
Whether the item is disabled or not. FALSE by default. Only if type is "action" or "heading". |
type |
Item type. Choose between "basic", "action" and "heading". |
src |
Item external link. |
title |
Item title (only if type is "heading"). |
subtitle |
Item subtitle (only if type is "heading"). |
footer |
Item footer content (only if type is "heading"). |
David Granjon, [email protected]
Create a Bootstrap 386 modal
Show a Bootstrap 386 modal
Hide a Bootstrap 386 modal
modal_386( ..., title = NULL, footer = modalButton("Dismiss"), size = c("m", "s", "l", "xl"), easyClose = FALSE, fade = TRUE ) show_modal_386(ui, session = getDefaultReactiveDomain()) remove_modal_386(session = getDefaultReactiveDomain())modal_386( ..., title = NULL, footer = modalButton("Dismiss"), size = c("m", "s", "l", "xl"), easyClose = FALSE, fade = TRUE ) show_modal_386(ui, session = getDefaultReactiveDomain()) remove_modal_386(session = getDefaultReactiveDomain())
... |
UI elements for the body of the modal dialog box. |
title |
An optional title for the dialog. |
footer |
UI for footer. Use |
size |
One of |
easyClose |
If |
fade |
If |
ui |
UI content to show in the modal. |
session |
The |
if (interactive()) { library(shiny) library(shiny386) shinyApp( ui = page_386( button_386("show", "Show modal dialog"), verbatimTextOutput("dataInfo") ), server = function(input, output) { # reactiveValues object for storing current data set. vals <- reactiveValues(data = NULL) # Return the UI for a modal dialog with data selection input. If 'failed' is # TRUE, then display a message that the previous value was invalid. dataModal <- function(failed = FALSE) { modal_386( textInput("dataset", "Choose data set", placeholder = 'Try "mtcars" or "abc"' ), span('(Try the name of a valid data object like "mtcars", ', 'then a name of a non-existent object like "abc")'), if (failed) div(tags$b("Invalid name of data object", style = "color: red;")), footer = tagList( modalButton("Cancel"), button_386("ok", "OK") ) ) } # Show modal when button is clicked. observeEvent(input$show, { show_modal_386(dataModal()) }) # When OK button is pressed, attempt to load the data set. If successful, # remove the modal. If not show another modal, but this time with a failure # message. observeEvent(input$ok, { # Check that data object exists and is data frame. if (!is.null(input$dataset) && nzchar(input$dataset) && exists(input$dataset) && is.data.frame(get(input$dataset))) { vals$data <- get(input$dataset) remove_modal_386() } else { show_modal_386(dataModal(failed = TRUE)) } }) # Display information about selected data output$dataInfo <- renderPrint({ if (is.null(vals$data)) "No data selected" else summary(vals$data) }) } ) }if (interactive()) { library(shiny) library(shiny386) shinyApp( ui = page_386( button_386("show", "Show modal dialog"), verbatimTextOutput("dataInfo") ), server = function(input, output) { # reactiveValues object for storing current data set. vals <- reactiveValues(data = NULL) # Return the UI for a modal dialog with data selection input. If 'failed' is # TRUE, then display a message that the previous value was invalid. dataModal <- function(failed = FALSE) { modal_386( textInput("dataset", "Choose data set", placeholder = 'Try "mtcars" or "abc"' ), span('(Try the name of a valid data object like "mtcars", ', 'then a name of a non-existent object like "abc")'), if (failed) div(tags$b("Invalid name of data object", style = "color: red;")), footer = tagList( modalButton("Cancel"), button_386("ok", "OK") ) ) } # Show modal when button is clicked. observeEvent(input$show, { show_modal_386(dataModal()) }) # When OK button is pressed, attempt to load the data set. If successful, # remove the modal. If not show another modal, but this time with a failure # message. observeEvent(input$ok, { # Check that data object exists and is data frame. if (!is.null(input$dataset) && nzchar(input$dataset) && exists(input$dataset) && is.data.frame(get(input$dataset))) { vals$data <- get(input$dataset) remove_modal_386() } else { show_modal_386(dataModal(failed = TRUE)) } }) # Display information about selected data output$dataInfo <- renderPrint({ if (is.null(vals$data)) "No data selected" else summary(vals$data) }) } ) }
Create Bootstrap 386 page skeleton
page_386(..., title = NULL)page_386(..., title = NULL)
... |
Slot for shiny386 layout elements. |
title |
The browser window title (defaults to the host URL of the page). Can also be set as a side effect of the titlePanel() function. |
A list of tags
The progress bar may be updated server side. See update_progress_386.
progress_386(id = NULL, value, status = NULL)progress_386(id = NULL, value, status = NULL)
id |
Progress unique id. |
value |
Progress value. Numeric between 0 and 100. |
status |
Progress status. |
A progress bar tag.
Create a Bootstrap 386 radio buttons
radio_input_386( inputId, label, choices = NULL, selected = NULL, width = NULL, choiceNames = NULL, choiceValues = NULL )radio_input_386( inputId, label, choices = NULL, selected = NULL, width = NULL, choiceNames = NULL, choiceValues = NULL )
inputId |
The |
label |
Display label for the control, or |
choices |
List of values to select from (if elements of the list are
named then that name rather than the value is displayed to the user). If
this argument is provided, then |
selected |
The initially selected value. If not specified, then it
defaults to the first item in |
width |
The width of the input, e.g. |
choiceNames, choiceValues
|
List of names and values, respectively, that
are displayed to the user in the app and correspond to the each choice (for
this reason, |
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( radio_input_386("dist", "Distribution type:", c("Normal" = "norm", "Uniform" = "unif", "Log-normal" = "lnorm", "Exponential" = "exp")), plotOutput("distPlot") ) server <- function(input, output, session) { output$distPlot <- renderPlot({ dist <- switch(input$dist, norm = rnorm, unif = runif, lnorm = rlnorm, exp = rexp, rnorm) hist(dist(500)) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( radio_input_386("dist", "Distribution type:", c("Normal" = "norm", "Uniform" = "unif", "Log-normal" = "lnorm", "Exponential" = "exp")), plotOutput("distPlot") ) server <- function(input, output, session) { output$distPlot <- renderPlot({ dist <- switch(input$dist, norm = rnorm, unif = runif, lnorm = rlnorm, exp = rexp, rnorm) hist(dist(500)) }) } shinyApp(ui, server) }
Create a Bootstrap 386 select input
select_input_386( inputId, label, choices, selected = NULL, multiple = FALSE, selectize = FALSE, width = NULL, size = NULL )select_input_386( inputId, label, choices, selected = NULL, multiple = FALSE, selectize = FALSE, width = NULL, size = NULL )
inputId |
The |
label |
Display label for the control, or |
choices |
List of values to select from. If elements of the list are
named, then that name — rather than the value — is displayed to the
user. It's also possible to group related inputs by providing a named list
whose elements are (either named or unnamed) lists, vectors, or factors. In
this case, the outermost names will be used as the group labels (leveraging
the |
selected |
The initially selected value (or multiple values if |
multiple |
Is selection of multiple items allowed? |
selectize |
Whether to use selectize.js or not. |
width |
The width of the input, e.g. |
size |
Number of items to show in the selection box; a larger number
will result in a taller box. Not compatible with |
Incompatible with selectize. Set to FALSE by default to have correct CSS rendering.
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( select_input_386("variable", "Variable:", c("Cylinders" = "cyl", "Transmission" = "am", "Gears" = "gear")), tableOutput("data") ) server <- function(input, output, session) { output$data <- renderTable({ mtcars[, c("mpg", input$variable), drop = FALSE] }, rownames = TRUE) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( select_input_386("variable", "Variable:", c("Cylinders" = "cyl", "Transmission" = "am", "Gears" = "gear")), tableOutput("data") ) server <- function(input, output, session) { output$data <- renderTable({ mtcars[, c("mpg", input$variable), drop = FALSE] }, rownames = TRUE) } shinyApp(ui, server) }
Old school Bootstrap 4 template for Shiny
Maintainer: David Granjon [email protected]
Useful links:
Report bugs at https://github.com/RinteRface/shiny386/issues
Show a Bootstrap 386 toast on the client
show_toast_386(id, options = NULL, session = getDefaultReactiveDomain())show_toast_386(id, options = NULL, session = getDefaultReactiveDomain())
id |
Toast id. |
options |
Toast options: see https://getbootstrap.com/docs/4.3/components/toasts/. |
session |
Shiny session |
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( toast_386( id = "toast", title = "Hello", subtitle = "now", "Toast body", img = "https://preview-dev.tabler.io/static/logo.svg" ), button_386("launch", "Go!", class = "btn-lg") ) server <- function(input, output, session) { observe(print(input$toast)) observeEvent(input$launch, { removeNotification("notif") show_toast_386( "toast", options = list( animation = FALSE, delay = 3000 ) ) }) observeEvent(input$toast, { showNotification( id = "notif", "Toast was closed", type = "warning", duration = 1, ) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( toast_386( id = "toast", title = "Hello", subtitle = "now", "Toast body", img = "https://preview-dev.tabler.io/static/logo.svg" ), button_386("launch", "Go!", class = "btn-lg") ) server <- function(input, output, session) { observe(print(input$toast)) observeEvent(input$launch, { removeNotification("notif") show_toast_386( "toast", options = list( animation = FALSE, delay = 3000 ) ) }) observeEvent(input$toast, { showNotification( id = "notif", "Toast was closed", type = "warning", duration = 1, ) }) } shinyApp(ui, server) }
Create a Bootstrap 386 tab panel
tab_panel_386(title, ..., value = title, icon = NULL)tab_panel_386(title, ..., value = title, icon = NULL)
title |
Display title for tab |
... |
UI elements to include within the tab |
value |
The value that should be sent when |
icon |
Optional icon to appear on the tab. This attribute is only
valid when using a |
Create a Bootstrap 386 tabset panel
tabset_panel_386( ..., id = NULL, selected = NULL, type = c("tabs", "pills"), position = NULL )tabset_panel_386( ..., id = NULL, selected = NULL, type = c("tabs", "pills"), position = NULL )
... |
|
id |
If provided, you can use |
selected |
The |
type |
|
position |
Tabs position (left or right). |
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( tabset_panel_386( id = "tabset", selected = "Tab 2", tabPanel("Tab 1", "Content 1"), tabPanel("Tab 2", "Content 2") ) ) server <- function(input, output, session) { observe(print(input$tabset)) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( tabset_panel_386( id = "tabset", selected = "Tab 2", tabPanel("Tab 1", "Content 1"), tabPanel("Tab 2", "Content 2") ) ) server <- function(input, output, session) { observe(print(input$tabset)) } shinyApp(ui, server) }
Create a Bootstrap 386 text area input
text_area_input_386( inputId, label, value = "", width = NULL, height = NULL, cols = NULL, rows = NULL, placeholder = NULL, resize = NULL )text_area_input_386( inputId, label, value = "", width = NULL, height = NULL, cols = NULL, rows = NULL, placeholder = NULL, resize = NULL )
inputId |
The |
label |
Display label for the control, or |
value |
Initial value. |
width |
The width of the input, e.g. |
height |
The height of the input, e.g. |
cols |
Value of the visible character columns of the input, e.g. |
rows |
The value of the visible character rows of the input, e.g. |
placeholder |
A character string giving the user a hint as to what can be entered into the control. Internet Explorer 8 and 9 do not support this option. |
resize |
Which directions the textarea box can be resized. Can be one of
|
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( textAreaInput("caption", "Caption", "Data Summary"), verbatimTextOutput("value") ) server <- function(input, output, session) { output$value <- renderText({ input$caption }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( textAreaInput("caption", "Caption", "Data Summary"), verbatimTextOutput("value") ) server <- function(input, output, session) { output$value <- renderText({ input$caption }) } shinyApp(ui, server) }
Create a Bootstrap 386 text input
text_input_386(inputId, label, value = "", width = NULL, placeholder = NULL)text_input_386(inputId, label, value = "", width = NULL, placeholder = NULL)
inputId |
The |
label |
Display label for the control, or |
value |
Initial value. |
width |
The width of the input, e.g. |
placeholder |
A character string giving the user a hint as to what can be entered into the control. Internet Explorer 8 and 9 do not support this option. |
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( textInput("caption", "Caption", "Data Summary"), verbatimTextOutput("value") ) server <- function(input, output, session) { output$value <- renderText({ input$caption }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( textInput("caption", "Caption", "Data Summary"), verbatimTextOutput("value") ) server <- function(input, output, session) { output$value <- renderText({ input$caption }) } shinyApp(ui, server) }
Display user feedback
toast_386(id, title = NULL, subtitle = NULL, ..., img = NULL)toast_386(id, title = NULL, subtitle = NULL, ..., img = NULL)
id |
Unique toast id. |
title |
Toast title. |
subtitle |
Toast subtitle. |
... |
Toast content. |
img |
Toast image. |
A toast
Similar to the shiny checkbox
toggle_input_386(inputId, label, value = FALSE, width = NULL)toggle_input_386(inputId, label, value = FALSE, width = NULL)
inputId |
The |
label |
Display label for the control, or |
value |
Initial value ( |
width |
The width of the input, e.g. |
A toggle input tag.
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( toggle_input_386("toggle", "Toggle me", TRUE), verbatimTextOutput("val") ) server <- function(input, output, session) { output$val <- renderPrint(input$toggle) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( toggle_input_386("toggle", "Toggle me", TRUE), verbatimTextOutput("val") ) server <- function(input, output, session) { output$val <- renderPrint(input$toggle) } shinyApp(ui, server) }
Change the value of a checkbox group input on the client
update_checkbox_group_input_386( session, inputId, label = NULL, choices = NULL, selected = NULL, choiceNames = NULL, choiceValues = NULL )update_checkbox_group_input_386( session, inputId, label = NULL, choices = NULL, selected = NULL, choiceNames = NULL, choiceValues = NULL )
session |
The session object passed to function given to shinyServer. |
inputId |
The |
label |
Display label for the control, or |
choices |
List of values to show checkboxes for. If elements of the list
are named then that name rather than the value is displayed to the user. If
this argument is provided, then |
selected |
The values that should be initially selected, if any. |
choiceNames, choiceValues
|
List of names and values, respectively,
that are displayed to the user in the app and correspond to the each
choice (for this reason, |
if (interactive()) { ui <- page_386( p("The first radio button group controls the second"), checkbox_group_input_386("inCheckboxGroup", "Input radio buttons", c("Item A", "Item B", "Item C")), checkbox_group_input_386("inCheckboxGroup2", "Input radio buttons 2", c("Item A", "Item B", "Item C")) ) server <- function(input, output, session) { observe({ x <- input$inCheckboxGroup # Can use character(0) to remove all choices if (is.null(x)) x <- character(0) # Can also set the label and select items update_checkbox_group_input_386(session, "inCheckboxGroup2", label = paste("Checkboxgroup label", length(x)), choices = x, selected = x ) }) } shinyApp(ui, server) }if (interactive()) { ui <- page_386( p("The first radio button group controls the second"), checkbox_group_input_386("inCheckboxGroup", "Input radio buttons", c("Item A", "Item B", "Item C")), checkbox_group_input_386("inCheckboxGroup2", "Input radio buttons 2", c("Item A", "Item B", "Item C")) ) server <- function(input, output, session) { observe({ x <- input$inCheckboxGroup # Can use character(0) to remove all choices if (is.null(x)) x <- character(0) # Can also set the label and select items update_checkbox_group_input_386(session, "inCheckboxGroup2", label = paste("Checkboxgroup label", length(x)), choices = x, selected = x ) }) } shinyApp(ui, server) }
Update checkbox_input_386 on the client
update_checkbox_input_386(session, inputId, label = NULL, value = NULL)update_checkbox_input_386(session, inputId, label = NULL, value = NULL)
session |
The |
inputId |
The id of the input object. |
label |
The label to set for the input object. |
value |
Initial value ( |
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( button_386("update", "Go!", class = "btn-lg"), checkbox_input_386("check", "Checked", value = TRUE) ) server <- function(input, output, session) { observe(print(input$check)) observeEvent(input$update, { update_checkbox_input_386( session, "toggle", value = !input$check ) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( button_386("update", "Go!", class = "btn-lg"), checkbox_input_386("check", "Checked", value = TRUE) ) server <- function(input, output, session) { observe(print(input$check)) observeEvent(input$update, { update_checkbox_input_386( session, "toggle", value = !input$check ) }) } shinyApp(ui, server) }
Update a progress_386 on the client
update_progress_386(id, value, session = shiny::getDefaultReactiveDomain())update_progress_386(id, value, session = shiny::getDefaultReactiveDomain())
id |
Progress unique id. |
value |
New value. |
session |
Shiny session object. |
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( button_386("update", "Update"), br(), progress_386(id = "progress1", 12) ) server <- function(input, output, session) { observeEvent(input$update, { update_progress_386( id = "progress1", sample(1:100, 1) ) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( button_386("update", "Update"), br(), progress_386(id = "progress1", 12) ) server <- function(input, output, session) { observeEvent(input$update, { update_progress_386( id = "progress1", sample(1:100, 1) ) }) } shinyApp(ui, server) }
Change the value of a radio input on the client
update_radio_input_386( session, inputId, label = NULL, choices = NULL, selected = NULL, choiceNames = NULL, choiceValues = NULL )update_radio_input_386( session, inputId, label = NULL, choices = NULL, selected = NULL, choiceNames = NULL, choiceValues = NULL )
session |
The session object passed to function given to shinyServer. |
inputId |
The |
label |
Display label for the control, or |
choices |
List of values to select from (if elements of the list are
named then that name rather than the value is displayed to the user). If
this argument is provided, then |
selected |
The initially selected value. If not specified, then it
defaults to the first item in |
choiceNames, choiceValues
|
List of names and values, respectively, that
are displayed to the user in the app and correspond to the each choice (for
this reason, |
if (interactive()) { ui <- page_386( p("The first radio button group controls the second"), radio_input_386("inRadioButtons", "Input radio buttons", c("Item A", "Item B", "Item C")), radio_input_386("inRadioButtons2", "Input radio buttons 2", c("Item A", "Item B", "Item C")) ) server <- function(input, output, session) { observe({ x <- input$inRadioButtons # Can also set the label and select items update_radio_input_386(session, "inRadioButtons2", label = paste("radioButtons label", x), choices = x, selected = x ) }) } shinyApp(ui, server) }if (interactive()) { ui <- page_386( p("The first radio button group controls the second"), radio_input_386("inRadioButtons", "Input radio buttons", c("Item A", "Item B", "Item C")), radio_input_386("inRadioButtons2", "Input radio buttons 2", c("Item A", "Item B", "Item C")) ) server <- function(input, output, session) { observe({ x <- input$inRadioButtons # Can also set the label and select items update_radio_input_386(session, "inRadioButtons2", label = paste("radioButtons label", x), choices = x, selected = x ) }) } shinyApp(ui, server) }
Update a Bootstrap 386 select input on the client
update_select_input_386( session = getDefaultReactiveDomain(), inputId, label = NULL, choices = NULL, selected = NULL )update_select_input_386( session = getDefaultReactiveDomain(), inputId, label = NULL, choices = NULL, selected = NULL )
session |
The |
inputId |
The id of the input object. |
label |
The label to set for the input object. |
choices |
List of values to select from. If elements of the list are
named, then that name — rather than the value — is displayed to the
user. It's also possible to group related inputs by providing a named list
whose elements are (either named or unnamed) lists, vectors, or factors. In
this case, the outermost names will be used as the group labels (leveraging
the |
selected |
The initially selected value (or multiple values if |
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( p("The radio group controls the select input"), radio_input_386("inCheckboxGroup", "Input checkbox", c("Item A", "Item B", "Item C")), select_input_386("inSelect", "Select input", c("Item A", "Item B", "Item C")) ) server <- function(input, output, session) { observe({ x <- input$inCheckboxGroup # Can use character(0) to remove all choices if (is.null(x)) x <- character(0) # Can also set the label and select items update_select_input_386(session, "inSelect", label = paste("Select input label", length(x)), choices = x, selected = tail(x, 1) ) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( p("The radio group controls the select input"), radio_input_386("inCheckboxGroup", "Input checkbox", c("Item A", "Item B", "Item C")), select_input_386("inSelect", "Select input", c("Item A", "Item B", "Item C")) ) server <- function(input, output, session) { observe({ x <- input$inCheckboxGroup # Can use character(0) to remove all choices if (is.null(x)) x <- character(0) # Can also set the label and select items update_select_input_386(session, "inSelect", label = paste("Select input label", length(x)), choices = x, selected = tail(x, 1) ) }) } shinyApp(ui, server) }
Update a Bootstrap 386 tabset panel on the client
update_tabset_panel_386( session = getDefaultReactiveDomain(), inputId, selected = NULL )update_tabset_panel_386( session = getDefaultReactiveDomain(), inputId, selected = NULL )
session |
The |
inputId |
The id of the |
selected |
The |
if (interactive()) { library(shiny) library(shiny386) ui <- page_386(sidebarLayout( sidebarPanel( radio_input_386("controller", "Controller", choices = c(1, 2, 3)) ), mainPanel( tabset_panel_386(id = "inTabset", tab_panel_386(title = "Panel 1", value = "panel1", "Panel 1 content"), tab_panel_386(title = "Panel 2", value = "panel2", "Panel 2 content"), tab_panel_386(title = "Panel 3", value = "panel3", "Panel 3 content") ) ) )) server <- function(input, output, session) { observeEvent(input$controller, { update_tabset_panel_386(session, "inTabset", selected = paste0("panel", input$controller) ) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386(sidebarLayout( sidebarPanel( radio_input_386("controller", "Controller", choices = c(1, 2, 3)) ), mainPanel( tabset_panel_386(id = "inTabset", tab_panel_386(title = "Panel 1", value = "panel1", "Panel 1 content"), tab_panel_386(title = "Panel 2", value = "panel2", "Panel 2 content"), tab_panel_386(title = "Panel 3", value = "panel3", "Panel 3 content") ) ) )) server <- function(input, output, session) { observeEvent(input$controller, { update_tabset_panel_386(session, "inTabset", selected = paste0("panel", input$controller) ) }) } shinyApp(ui, server) }
Update a Bootstrap 386 text area input on the client
update_text_area_input_386( session = getDefaultReactiveDomain(), inputId, label = NULL, value = NULL, placeholder = NULL )update_text_area_input_386( session = getDefaultReactiveDomain(), inputId, label = NULL, value = NULL, placeholder = NULL )
session |
The |
inputId |
The id of the input object. |
label |
The label to set for the input object. |
value |
Initial value. |
placeholder |
A character string giving the user a hint as to what can be entered into the control. Internet Explorer 8 and 9 do not support this option. |
Update a Bootstrap 386 text input on the client
update_text_input_386( session = getDefaultReactiveDomain(), inputId, label = NULL, value = NULL, placeholder = NULL )update_text_input_386( session = getDefaultReactiveDomain(), inputId, label = NULL, value = NULL, placeholder = NULL )
session |
The |
inputId |
The id of the input object. |
label |
The label to set for the input object. |
value |
Initial value. |
placeholder |
A character string giving the user a hint as to what can be entered into the control. Internet Explorer 8 and 9 do not support this option. |
Update toggle_input_386 on the client
update_toggle_input_386(session, inputId, label = NULL, value = NULL)update_toggle_input_386(session, inputId, label = NULL, value = NULL)
session |
The |
inputId |
The id of the input object. |
label |
The label to set for the input object. |
value |
Initial value ( |
if (interactive()) { library(shiny) library(shiny386) ui <- page_386( button_386("update", "Go!", class = "btn-lg"), toggle_input_386("toggle", "Switch", value = TRUE) ) server <- function(input, output, session) { observe(print(input$toggle)) observeEvent(input$update, { update_toggle_input_386( session, "toggle", value = !input$toggle ) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny386) ui <- page_386( button_386("update", "Go!", class = "btn-lg"), toggle_input_386("toggle", "Switch", value = TRUE) ) server <- function(input, output, session) { observe(print(input$toggle)) observeEvent(input$update, { update_toggle_input_386( session, "toggle", value = !input$toggle ) }) } shinyApp(ui, server) }
Add all necessary dependencies so that shiny386 renders well
use_bs4_deps(tag)use_bs4_deps(tag)
tag |
Tag on which to add dependencies. We usually target the body. |
Validate a progress_386 value
validate_progress_value(value)validate_progress_value(value)
value |
Value to validate. |
An error is raised if the value does not met expectations.
Validate the status of a Bootstrap 386 element.
validate_status(status)validate_status(status)
status |
Color to validate. |
TRUE if the test pass.
## Not run: validate_status("danger") validate_status("maroon") ## End(Not run)## Not run: validate_status("danger") validate_status("maroon") ## End(Not run)