shinyBS/ 0000755 0001762 0000144 00000000000 15156540112 011631 5 ustar ligges users shinyBS/MD5 0000644 0001762 0000144 00000007453 15156540112 012152 0 ustar ligges users a8d4f267f8a38cba45848f56b12b8ee1 *DESCRIPTION
99a4b10ea32c97a9634f8d945bdeb38e *NAMESPACE
246cf500f8a5537e4ad1f8b428325bba *NEWS.md
a100c5a0c5a6ce65ff7f9349f3075d11 *R/Alerts.R
acf6a101bce869ded85ade7129e265d4 *R/Buttons.R
ce847e6a681f6eb468df303150f04cf3 *R/Collapses.R
2cdbd3f69abc89135ec6632356b33767 *R/Modals.R
d8eb002e7429743586da9ae984d2b6c1 *R/Tooltips_and_Popovers.R
375d6d4adfd935d0039701ab098e9eaf *R/addPopover.R
4b8da22366345723f646d093045d6a8d *R/addTooltip.R
c9171623c19e98046197b52cbe930c82 *R/bsAlert.R
b7cdd71b1b3f35d35fe12ec1f942a787 *R/bsButton.R
a91ec3da0ce2eb02db0339a3168e562e *R/bsCollapse.R
7528fccee981f1bc1a7afc305a03679e *R/bsCollapsePanel.R
5aa47dc3ce2c3ccb728694c3fd43cf30 *R/bsExample.R
787cd429af38bc5062b71fb540ddc423 *R/bsModal.R
18dbcbdb5b061238b936dcf037f4a40d *R/bsPopover.R
2e50e1cd121aa5586751d05f578677d3 *R/bsTooltip.R
bc873ef4f8d036331d18fabbff6707ee *R/bsTypeahead.R
624d22721ae65a90c184b0b0e4dc0303 *R/closeAlert.R
ba95dd8f623a962ceeff4ea4f10fc396 *R/createAlert.R
09f975f0a900529a2115c1916ed68132 *R/misc.R
41755a98b3bc3a3476f54c81b66d2b89 *R/popify.R
1c3dab809e56a5234c4bcad7958a4351 *R/removePopover.R
6957a9353525aee605ac32b1f9449ffe *R/removeTooltip.R
e723c90f93572d8bc46a0d4ed38e2aa0 *R/tagManipulators.R
305b0296d40d29c2c14e7df7ff86254c *R/tipify.R
82302b12bea2eb7754417ca8b10bff45 *R/toggleModal.R
5234a414b3ba12ece4b87155f96766f1 *R/updateButton.R
29bb9392e7f4a0d2ee21009fc4a49c11 *R/updateCollapse.R
a9fda7f44c4f1764c23bf1491e163b8e *R/updateTypeahead.R
ebbe56cf1af61de3e8b5a9772432264e *inst/examples/Alerts/server.R
27855eda0745026cb4b4aa2c445aee76 *inst/examples/Alerts/ui.R
bad9aee73b2be916922afa555971c563 *inst/examples/Buttons/server.R
79d528cf3a75d2673f438f46c171dfb6 *inst/examples/Buttons/ui.R
13ec7fad76b0a8f4debb1769209d026f *inst/examples/Collapses/server.R
7208541419411613b32dfa3caf4d6b74 *inst/examples/Collapses/ui.R
7830c90bc677e3ad39552dab6e797c22 *inst/examples/Modals/server.R
2735cd2aac0c78100a1cab22384cea6c *inst/examples/Modals/ui.R
54f116835cb34ca645e9909ea84bbefc *inst/examples/TooltipsandPopovers/server.R
8128f93c0bcc2ac0ff91a2b70c3462ab *inst/examples/TooltipsandPopovers/ui.R
2ff49c216c41474baa9dc4722e6c4a8d *inst/tests/tipify_test.R
8d08bac638e823d8c6d4a0cb8430f9ff *inst/tests/tipify_test2.R
5afe1b650a3e0ff9f54ac0029ea4dfbe *inst/www/bootstrap3-typeahead.js
de5b444d3f571fe21b4615959d0e00ec *inst/www/shinyBS.css
47b3f39a8295dad71e88a2e32ab37ee6 *inst/www/shinyBS.js
afb96d221561eea962eafbf5d078ecea *inst/www/typeahead_inputbinding.js
e4d14ed71dc284cd9437f5b087145cfb *man/Alerts.Rd
d6897d74b6310e8b6e81234a4ef136b0 *man/Buttons.Rd
f7f280bc7f38b20893494f97313ab30e *man/Collapses.Rd
17379ed6b7777ecc5be73de5797b1bc5 *man/Modals.Rd
033e697830261881389c59c8e75875b3 *man/Tooltips_and_Popovers.Rd
504e0164382e146b9fc666a6b3844405 *man/addPopover.Rd
7470fdb07c53d21c6583df3a45e225ec *man/addTooltip.Rd
e800729a1e8ab460389d724c920acf30 *man/bsAlert.Rd
b2079774eeff78a766248ebc1551210e *man/bsButton.Rd
994eb890161da240890043bcf94127e6 *man/bsCollapse.Rd
c7114669f95b8ba073859656665023cd *man/bsCollapsePanel.Rd
fa388242fc6ed3400dfdc3e0515d6a04 *man/bsExample.Rd
c14d07d69ab6eafab2c6753080d3377c *man/bsModal.Rd
a63eecb50b4a9a73febf053fedc42e52 *man/bsPopover.Rd
3bd09e86bf6a83d1b22f24f2ad225ff0 *man/bsTooltip.Rd
d85dc3c4bc4311bd8985a43feefeeef5 *man/bsTypeahead.Rd
2dc0384b4f5eb2d4408f4dd00846632a *man/closeAlert.Rd
98acbbbb36f5fd4dabd30abdfacf07b3 *man/createAlert.Rd
b1ffe58216f76df85cd09e3ca79945e0 *man/popify.Rd
17c4e68dbaf225a305f00567a5265010 *man/removePopover.Rd
dc6430e34fad30f7679fc2dffa144fd1 *man/removeTooltip.Rd
dec01183cb1149fed6743ce8df5a1648 *man/tipify.Rd
1350940f6cd98f00c22ddbdf5af1bbf4 *man/toggleModal.Rd
5e69bb6371fbe9d7c4aa2626ea8a686f *man/updateButton.Rd
52f136c2e1172d15d9313d30bdbc905f *man/updateCollapse.Rd
9df1d768bffc067225a48341dfd53dcb *man/updateTypeahead.Rd
shinyBS/R/ 0000755 0001762 0000144 00000000000 15120510337 012027 5 ustar ligges users shinyBS/R/bsTooltip.R 0000644 0001762 0000144 00000001740 15116513141 014134 0 ustar ligges users #'bsTooltip
#'
#'\code{bsTooltip} is used within the UI of an app to add a tooltip to a Shiny
#'input or output.
#'
#'@param id The id of the element to attach the tooltip to.
#'@param title The content of the tooltip.
#'@param placement Where the tooltip should appear relative to its target
#'(\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}.
#'@param trigger What action should cause the tooltip to appear? (\code{hover},
#'\code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}.
#'@param options A named list of additional options to be set on the tooltip.
#'
#'@templateVar item_name bsTooltip
#'@templateVar family_name Tooltips_and_Popovers
#'@template item_details
#'@template footer
#'@export
bsTooltip <- function(id, title, placement="bottom", trigger="hover", options = NULL) {
options = buildTooltipOrPopoverOptionsList(title, placement, trigger, options)
createTooltipOrPopoverOnUI(id, "tooltip", options)
} shinyBS/R/createAlert.R 0000644 0001762 0000144 00000002423 15116513141 014407 0 ustar ligges users #'createAlert
#'
#'\code{createAlert} is used within the Server logic of your Shiny app to display
#'an alert to the user.
#'
#'@param session The session object passed to function given to shinyServer.
#'@param anchorId The unique identifier of the anchor where the alert should be
#'displayed.
#'@param alertId \bold{Optional} A unique identifier for the Alert.
#'@param title \bold{Optional} A title for the Alert.
#'@param content The main body of the Alert. HTML tags are allowed.
#'@param style A bootstrap style to apply. Defaults to \code{info}.
#'@param dismiss \code{logical} Should the Alert be user dismissable? Defaults to \code{TRUE}.
#'@param append \code{logical} Should the Alert be appended below existing Alerts? Default to \code{TRUE}.
#'
#'@templateVar item_name createAlert
#'@templateVar family_name Alerts
#'@template item_details
#'@template footer
#'@export
createAlert <- function(session, anchorId, alertId = NULL, title=NULL,
content=NULL, style=NULL, dismiss=TRUE, append=TRUE) {
data <- dropNulls(list(id = anchorId, alertId = alertId, title = title,
content = content, style = style, dismiss = dismiss,
append = append))
session$sendCustomMessage(type="bsAlertCreate", data)
}
shinyBS/R/Modals.R 0000644 0001762 0000144 00000005620 15116525551 013405 0 ustar ligges users #'Modals
#'
#'Modal windows are similar to popups but are rendered within the
#'original window. They can contain any combination of shiny inputs, shiny
#'outputs, and html. Possible uses include extra controls that you don't want
#'cluttering up the main app display or help pages to explain your apps
#'operation.
#'
#'@section Components:
#'There are only two functions in the Modals family:
#' \describe{
#' \item{\code{\link{bsModal}}}{Used in the UI to create a modal window.}
#' \item{\code{\link{toggleModal}}}{Used in the Server logic to open or
#' close a modal window programmatically.}
#' }
#'
#'@details
#'Use \code{\link{bsModal}} in your UI to create a modal window. It works
#'like \code{\link{Collapses}} or \code{\link[shiny:tabPanel]{tabPanel}}, any non-named arguments
#'will be passed as content for the modal.
#'
#'Create a button or link and assign its \code{inputId} as the \code{trigger}
#'in \code{\link{bsModal}}.
#'
#'@section Changes:
#'There is now a \code{toggle} argument in \code{\link{toggleModal}} that allows
#'you to specify whether you want the modal to open or close.
#'
#'The \code{size} argument in \code{\link{bsModal}} allows you to specify the
#'size of the modal window. Either \code{small} or \code{large}.
#'
#'@examples
#'library(shiny)
#'library(shinyBS)
#'
#'app = shinyApp(
#' ui =
#' fluidPage(
#' sidebarLayout(
#' sidebarPanel(
#' sliderInput("bins",
#' "Number of bins:",
#' min = 1,
#' max = 50,
#' value = 30),
#' actionButton("tabBut", "View Table")
#' ),
#'
#' mainPanel(
#' plotOutput("distPlot"),
#' bsModal("modalExample", "Data Table", "tabBut", size = "large",
#' dataTableOutput("distTable"))
#' )
#' )
#' ),
#' server =
#' function(input, output, session) {
#'
#' output$distPlot <- renderPlot({
#'
#' x <- faithful[, 2]
#' bins <- seq(min(x), max(x), length.out = input$bins + 1)
#'
#' # draw the histogram with the specified number of bins
#' hist(x, breaks = bins, col = 'darkgray', border = 'white')
#'
#' })
#'
#' output$distTable <- renderDataTable({
#'
#' x <- faithful[, 2]
#' bins <- seq(min(x), max(x), length.out = input$bins + 1)
#'
#' # draw the histogram with the specified number of bins
#' tab <- hist(x, breaks = bins, plot = FALSE)
#' tab$breaks <- sapply(seq(length(tab$breaks) - 1), function(i) {
#' paste0(signif(tab$breaks[i], 3), "-", signif(tab$breaks[i+1], 3))
#' })
#' tab <- as.data.frame(do.call(cbind, tab))
#' colnames(tab) <- c("Bins", "Counts", "Density")
#' return(tab[, 1:3])
#'
#' }, options = list(pageLength=10))
#'
#' }
#')
#'\dontrun{
#' runApp(app)
#'}
#'@templateVar family_name Modals
#'@templateVar item_name Modals
#'@template footer
NULL
shinyBS/R/removePopover.R 0000644 0001762 0000144 00000001120 15116513141 015015 0 ustar ligges users #'removePopover
#'
#'\code{removePopover} is used within the Server logic of an app to remove an
#'existing popover from a Shiny input or output.
#'
#'@param session The session object passed to function given to shinyServer.
#'@param id The id of the element to remove the popover from.
#'
#'@templateVar item_name removePopover
#'@templateVar family_name Tooltips_and_Popovers
#'@template item_details
#'@template footer
#'@export
removePopover <- function(session, id) {
session$sendCustomMessage(type="updateTooltipOrPopover", list(action = "remove", type = "popover", id = id))
} shinyBS/R/updateButton.R 0000644 0001762 0000144 00000002457 15116525674 014657 0 ustar ligges users #'updateButton
#'
#'\code{updateButton} is used in your Server logic to update the style or state
#'of a button.
#'
#'@inheritParams bsButton
#'@param session The session object passed to function given to shinyServer.
#'
#'@details Because of the way it is coded, \code{updateButton} may work on buttons not
#'created by \code{\link{bsButton}} such as \code{\link[shiny:submitButton]{submitButton}}.
#'
#'See \code{\link{Buttons}} for more information about how to use \code{updateButton} with the rest of the Buttons family.
#'
#'@templateVar item_name updateButton
#'@templateVar family_name Buttons
#'@template item_details
#'@template footer
#'@export
updateButton <- function(session, inputId, label = NULL, icon = NULL, value = NULL, style = NULL,
size = NULL, block = NULL, disabled = NULL) {
if(!is.null(icon)) icon <- as.character(icon)
if(!is.null(size)) {
size <- switch(size,
"extra-small" = "btn-xs",
"small" = "btn-sm",
"large" = "btn-lg",
"default" = "default")
}
data <- dropNulls(list(id = inputId, label = label, icon = icon, value = value, style = style,
size = size, block = block, disabled = disabled))
session$sendCustomMessage("bsButtonUpdate", data)
} shinyBS/R/Collapses.R 0000644 0001762 0000144 00000005371 15116525503 014113 0 ustar ligges users #'Collapses
#'
#' Collapse panels allow you to reduce clutter in your Shiny app by making
#' panels of information that open and close with a user's click. Any type of
#' content can go in a collapse panel. Standard Bootstrap styling options are
#' available.
#'
#'@section Components:
#' \describe{
#' \item{\code{\link{bsCollapse}}}{A container for holder the individual panels created by \code{\link{bsCollapsePanel}}.}
#' \item{\code{\link{bsCollapsePanel}}}{Creates an individual Collapse Panel that resides within a \code{\link{bsCollapse}}.}
#' \item{\code{\link{updateCollapse}}}{Used within your server logic to open/close collapse panels or change their style.}
#'}
#'
#'@details
#'Collapses are designed to mimic \code{\link[shiny:tabsetPanel]{tabsetPanel}} in their implementation.
#'Start with \code{bsCollapse} to create a panel group, then fill it with panels
#'using \code{bsCollapsePanel}.
#'
#'\code{bsCollapse} acts as an input, so you can retrieve which panels are open
#'from the input object passed to the function in \code{\link[shiny:shinyServer]{shinyServer}}.
#'
#'\code{updateCollapse} can be used within your server logic to open/close
#'collapse panels or to change their style.
#'
#'@section Changes:
#'\code{style} is a new option that wasn't available in previous versions of
#'shinyBS.
#'
#'@examples
#'library(shiny)
#'library(shinyBS)
#'
#'app = shinyApp(
#' ui =
#' fluidPage(
#' sidebarLayout(
#' sidebarPanel(HTML("This button will open Panel 1 using updateCollapse."),
#' actionButton("p1Button", "Push Me!"),
#' selectInput("styleSelect", "Select style for Panel 1",
#' c("default", "primary", "danger", "warning", "info", "success"))
#' ),
#' mainPanel(
#' bsCollapse(id = "collapseExample", open = "Panel 2",
#' bsCollapsePanel("Panel 1", "This is a panel with just text ",
#' "and has the default style. You can change the style in ",
#' "the sidebar.", style = "info"),
#' bsCollapsePanel("Panel 2", "This panel has a generic plot. ",
#' "and a 'success' style.", plotOutput("genericPlot"), style = "success")
#' )
#' )
#' )
#' ),
#' server =
#' function(input, output, session) {
#' output$genericPlot <- renderPlot(plot(rnorm(100)))
#' observeEvent(input$p1Button, ({
#' updateCollapse(session, "collapseExample", open = "Panel 1")
#' }))
#' observeEvent(input$styleSelect, ({
#' updateCollapse(session, "collapseExample", style = list("Panel 1" = input$styleSelect))
#' }))
#' }
#')
#'\dontrun{
#' runApp(app)
#'}
#'@templateVar item_name Collapses
#'@templateVar family_name Collapses
#'@template footer
NULL
shinyBS/R/bsModal.R 0000644 0001762 0000144 00000004660 15116513141 013542 0 ustar ligges users #'bsModal
#'
#'\code{bsModal} is used within the UI to create a modal window.
#'
#'@param id A unique identifier for the modal window
#'@param title The title to appear at the top of the modal
#'@param trigger The id of a button or link that will open the modal.
#'@param \dots UI elements to include within the modal
#'@param size \bold{Optional} What size should the modal be? (\code{small} or \code{large})
#'@param footer A \code{list} of shiny UI elements to be added to the footer of the modal.
#'@param close.button Should a close button be added to the footer of the modal?
#'@param width An optional width argument for the modal. Must include units. Only applied if \code{size} is missing.
#'@templateVar item_name bsModal
#'@templateVar family_name Modals
#'@template item_details
#'@template footer
#'@export
bsModal <- function(id, title, trigger, ..., size, footer = NULL, close.button = TRUE, width = NULL) {
if(!missing(size)) {
if(size == "large") {
size = "modal-lg"
} else if(size == "small") {
size = "modal-sm"
}
size <- paste("modal-dialog", size)
width = NULL
} else {
size <- "modal-dialog"
}
if(is.null(footer)) {
footer <- tagList()
}
if(close.button) {
footer <- shiny::tagAppendChild(footer, tagList(shiny::tags$button(type = "button", class = "btn btn-default", "data-dismiss" = "modal", "Close")))
}
bsTag <- shiny::tags$div(class = size,
shiny::tags$div(class = "modal-content",
shiny::tags$div(class = "modal-header",
shiny::tags$button(type = "button", class = "close", "data-dismiss" = "modal", shiny::tags$span(shiny::HTML("×"))),
shiny::tags$h4(class = "modal-title", title)
),
shiny::tags$div(class = "modal-body", list(...)),
shiny::tags$div(class = "modal-footer",
footer
)
)
)
if(!is.null(width)) {
bsTag <- addAttribs(bsTag, style = paste0("width: ", width, " !important;"))
}
bsTag <- shiny::tags$div(class = "modal sbs-modal fade", id = id, tabindex = "-1", "data-sbs-trigger" = trigger,
bsTag
)
htmltools::attachDependencies(bsTag, shinyBSDep)
}
shinyBS/R/removeTooltip.R 0000644 0001762 0000144 00000001120 15116513141 015015 0 ustar ligges users #'removeTooltip
#'
#'\code{removeTooltip} is used within the Server logic of an app to remove an
#'existing tooltip from a Shiny input or output.
#'
#'@param session The session object passed to function given to shinyServer.
#'@param id The id of the element to remove the tooltip from.
#'
#'@templateVar item_name removeTooltip
#'@templateVar family_name Tooltips_and_Popovers
#'@template item_details
#'@template footer
#'@export
removeTooltip <- function(session, id) {
session$sendCustomMessage(type="updateTooltipOrPopover", list(action = "remove", type = "tooltip", id = id))
} shinyBS/R/misc.R 0000644 0001762 0000144 00000001710 15116513141 013105 0 ustar ligges users .onAttach <- function(...) {
# Create link to javascript and css files for package
shiny::addResourcePath("sbs", system.file("www", package="shinyBS"))
}
shinyBSDep <- htmltools::htmlDependency("shinyBS", packageVersion("shinyBS"), src = c("href" = "sbs"), script = "shinyBS.js", stylesheet = "shinyBS.css")
typeaheadDep <- htmltools::htmlDependency("shinyBS", packageVersion("shinyBS"), src = c("href" = "sbs"), script = c("bootstrap3-typeahead.js", "typeahead_inputbinding.js"));
# Copy of dropNulls function for shiny to avoid using shiny:::dropNulls
dropNulls <- function(x) {
x[!vapply(x, is.null, FUN.VALUE = logical(1))]
}
addAttribs <- function(tag, ...) {
a <- list(...)
for(i in seq(length(a))) {
tag$attribs[names(a)[i]] = a[[i]]
}
return(tag)
}
removeAttribs <- function(tag, ...) {
a <- list(...)
for(i in seq(length(a))) {
tags$attribs[a[[i]]] = NULL
}
return(tag)
}
getAttribs <- function(tag) {
tag$attribs
}
shinyBS/R/closeAlert.R 0000644 0001762 0000144 00000000714 15116513141 014252 0 ustar ligges users #'closeAlert
#'
#'\code{closeAlert} is used within your Server logic to close an alert that you
#'created with \code{\link{createAlert}}.
#'
#'@param alertId The id of the alert to be dismissed.
#'@inheritParams createAlert
#'
#'@templateVar item_name closeAlert
#'@templateVar family_name Alerts
#'@template item_details
#'@template footer
#'@export
closeAlert <- function(session, alertId) {
session$sendCustomMessage(type="bsAlertClose", alertId)
} shinyBS/R/bsCollapse.R 0000644 0001762 0000144 00000003076 15116524476 014265 0 ustar ligges users #'bsCollapse
#'
#'\code{bsCollapse} is used in your UI to create a collapse panel group. Use
#'\code{\link{bsCollapsePanel}} to populate this object with panels.
#'
#'@param \dots \code{\link{bsCollapsePanel}} elements to include in the Collapse.
#'@param id \bold{Optional} You can use \code{input$id} in your Server logic to
#'determine which panels are open, and \code{\link{updateCollapse}} to open/close
#'panels.
#'@param multiple Can more than one panel be open at a time? Defaults to \code{FALSE}.
#'@param open The \code{value}, (or if none was supplied, the \code{title}) of
#'the panel(s) you want open on load.
#'
#'@templateVar item_name bsCollapse
#'@templateVar family_name Collapses
#'@template item_details
#'@template footer
#'
#'@importFrom stats runif
#'@export
bsCollapse <- function(..., id = NULL, multiple = FALSE, open = NULL) {
if(is.null(id)) id = paste0("collapse", sprintf("%07i", as.integer(stats::runif(1, 1, 1000000))))
if(!multiple & length(open) > 1) {
open <- open[1]
}
panels <- list(...)
for(i in seq(length(panels))) {
if(getAttribs(panels[[i]])$value %in% open) {
panels[[i]]$children[[2]] <- addClass(panels[[i]]$children[[2]], "in")
}
if(!multiple) {
panels[[i]]$children[[1]]$children[[1]]$children[[1]] <- addAttribs(panels[[i]]$children[[1]]$children[[1]]$children[[1]], 'data-parent' = paste0("#", id))
}
}
bsTag <- shiny::tags$div(class = "panel-group sbs-panel-group", "data-sbs-multi" = multiple, id=id, role = "tablist", panels)
htmltools::attachDependencies(bsTag, shinyBSDep)
}
shinyBS/R/Buttons.R 0000644 0001762 0000144 00000007661 15116525223 013627 0 ustar ligges users #'Buttons
#'
#'Twitter Bootstrap gives many options for styling buttons that aren't made
#'available by standard Shiny. Use shinyBS to create buttons of different sizes,
#'shapes, and colors.
#'
#'@section Components:
#'There are two functions in the Buttons family:
#' \describe{
#' \item{\code{\link{bsButton}}}{Used in the UI to create a button. Buttons
#' can be of the type \code{action} or \code{toggle}.}
#' \item{\code{\link{updateButton}}}{Used in the Server logic to modify the
#' state of a button created with \code{\link{bsButton}}}
#' }
#'
#'@details
#'Create a button in the UI with \code{\link{bsButton}}. If \code{type = "action"}
#'the button will behave like the standard \code{\link[shiny:actionButton]{actionButton}} in shiny.
#'If \code{type = "toggle"} the button will behave like a \code{\link[shiny:checkboxInput]{checkboxInput}}
#'with an on and off state. It will return \code{TRUE} or \code{FALSE} to the Server
#'depending on its state.
#'
#'You can update the style and state of a \code{\link{bsButton}} from the Server
#'logic with \code{\link{updateButton}}. For example, a button could be set to
#'\code{disabled = TRUE} until the user has made some other selections, then once
#'those selections have been made, an observer on the Server could use \code{\link{updateButton}}
#'to enable the button allowing the user to proceed. Alternatively, you could set
#'the button to \code{style = "success"} to let them know that the button is ready
#'to be clicked.
#'
#'@section Changes:
#'\code{bsActionButton} and \code{bsToggleButton} were replaced with just
#'\code{\link{bsButton}} with a \code{type} argument.
#'
#'\code{icon} was added to allow placing an icon in the button.
#'
#'@examples
#'library(shiny)
#'library(shinyBS)
#'app = shinyApp(
#' ui =
#' fluidPage(
#' sidebarLayout(
#' sidebarPanel(
#' sliderInput("bins",
#' "Move the slider to see its effect on the button below:",
#' min = 1,
#' max = 50,
#' value = 1),
#' bsButton("actTwo", label = "Click me if you dare!", icon = icon("ban")),
#' tags$p("Clicking the first button below changes the disabled state of the second button."),
#' bsButton("togOne", label = "Toggle button disabled status",
#' block = TRUE, type = "toggle", value = TRUE),
#' bsButton("actOne", label = "Block Action Button", block = TRUE)
#'
#' ),
#' mainPanel(
#' textOutput("exampleText")
#' )
#' )
#' ),
#' server =
#' function(input, output, session) {
#' observeEvent(input$togOne, ({
#' updateButton(session, "actOne", disabled = !input$togOne)
#' }))
#' observeEvent(input$bins, ({
#'
#' b <- input$bins
#' disabled = NULL
#' style = "default"
#' icon = ""
#'
#' if(b < 5) {
#' disabled = TRUE
#' icon <- icon("ban")
#' } else {
#' disabled = FALSE
#' }
#'
#' if(b < 15 | b > 35) {
#' style = "danger"
#' } else if(b < 20 | b > 30) {
#' style = "warning"
#' } else {
#' style = "default"
#' icon = icon("check")
#' }
#'
#' updateButton(session, "actTwo", disabled = disabled, style = style, icon = icon)
#'
#' }))
#'
#' output$exampleText <- renderText({
#' input$actTwo
#' b <- isolate(input$bins)
#' txt = ""
#' if((b > 5 & b < 15) | b > 35) {
#' txt = "That was dangerous."
#' } else if((b > 5 & b < 20) | b > 30) {
#' txt = "I warned you about that."
#' } else if(b >= 20 & b <= 30) {
#' txt = "You have chosen... wisely."
#' }
#' return(txt)
#' })
#' }
#')
#'\dontrun{
#' runApp(app)
#'}
#'@templateVar item_name Buttons
#'@templateVar family_name Buttons
#'@template footer
NULL shinyBS/R/updateCollapse.R 0000644 0001762 0000144 00000002245 15116513141 015123 0 ustar ligges users #'updateCollapse
#'
#'\code{updateCollapse} is used within the Server logic of your Shiny app to
#'modify a Collapse after load.
#'
#'@param session The session object passed to function given to shinyServer.
#'@param id The id of the Collapse object you want to change.
#'@param open A vector of \code{value} (or \code{title} if no \code{value} was
#'provided) values identifying the panels you want to open.
#'@param close A vector of \code{value} (or \code{title} if no \code{value} was
#'provided) values identifying the panels you want to close.
#'@param style A named list of Bootstrap styles (\code{primary}, \code{danger}, \code{info},
#'\code{warning}, \code{success}, or \code{default}). The names should correspond
#'to the \code{value} (or \code{title} if no \code{value} was provided) of the
#'\code{\link{bsCollapsePanel}} you want to change.
#'
#'@templateVar item_name updateCollapse
#'@templateVar family_name Collapses
#'@template item_details
#'@template footer
#'@export
updateCollapse <- function(session, id, open = NULL, close = NULL, style = NULL) {
data <- dropNulls(list(open = open, close = close, style = style))
session$sendInputMessage(id, data)
} shinyBS/R/Tooltips_and_Popovers.R 0000644 0001762 0000144 00000014276 15120510337 016520 0 ustar ligges users #'Tooltips and Popovers
#'
#'Tooltips and Popovers allow you to add additional information about controls
#'or outputs without cluttering up your user interface. You can add a tooltip to
#'a button that displays on hover and better explains what the button will do, or
#'you could add a popover to an output providing further analysis of that output.
#'
#'@section Components:
#'There are eight functions in the Tooltips and Popovers family:
#' \describe{
#' \item{\code{\link{bsTooltip}}}{Used in the UI to add a tooltip to an element
#' in your UI.}
#' \item{\code{\link{bsPopover}}}{Used in the UI to add a popover to an element
#' in your UI.}
#' \item{\code{\link{tipify}}}{Wrap any UI element in \code{tipify} to add a
#' tooltip to the wrapped element. Preferred for elemented created with
#' \code{\link[shiny:renderUI]{renderUI}}.}
#' \item{\code{\link{popify}}}{Wrap any UI element in \code{popify} to add a
#' popover to the wrapped element. Preferred for elements created with
#' \code{\link[shiny:renderUI]{renderUI}}.}
#' \item{\code{\link{addTooltip}}}{Used in the Server logic to add a tooltip
#' to an element in your UI.}
#' \item{\code{\link{addPopover}}}{Used in the Server logic to add a popover
#' to an element in your UI.}
#' \item{\code{\link{removeTooltip}}}{Used in the Server logic to remove a
#' tooltip from an element in your UI.}
#' \item{\code{\link{removePopover}}}{Used in the Server logic to remove a
#' popover from an element in your UI.}
#' }
#'
#'@details
#'You can create tooltips and popovers from either the UI script or within the
#'Server logic. \code{\link{bsTooltip}} and \code{\link{bsPopover}} are used in
#'the UI, and \code{\link{addTooltip}} and \code{\link{addPopover}} are used in
#'the Server logic. \code{\link{tipify}} and \code{\link{popify}} can be used
#'within the UI or from within a \code{\link[shiny:renderUI]{renderUI}} in the Server logic. They
#'also have the added advantage of not requiring that the UI element have an ID
#'attribute.
#'
#'@note
#'Tooltips and Popovers cannot contain shiny inputs or outputs.
#'
#'There must be at least one \code{shinyBS} component in the UI of your
#'app in order for the necessary dependencies to be loaded. Because of this,
#'\code{\link{addTooltip}} and \code{\link{addPopover}} will not work if they
#'are the only shinyBS components in your app.
#'
#'Tooltips and popovers may not work on some of the more complex shiny inputs
#'or outputs. If you encounter a problem with tooltips or popovers not appearing
#'please file a issue on the github page so I can fix it.
#'
#'@section Changes:
#'An \code{options} argument has been added to the creation functions to allow
#'advanced users more control over how the tooltips and popovers appear. See
#'the \href{https://getbootstrap.com}{Twitter Bootstrap 3 documentation} for more
#'details.
#'
#'@examples
#'library(shiny)
#'library(shinyBS)
#'
#'app = shinyApp(
#' ui =
#' fluidPage(
#' sidebarLayout(
#' sidebarPanel(
#' sliderInput("bins",
#' "Number of bins:",
#' min = 1,
#' max = 50,
#' value = 30),
#' bsTooltip("bins", "The wait times will be broken into this many equally spaced bins",
#' "right", options = list(container = "body"))
#' ),
#' mainPanel(
#' plotOutput("distPlot"),
#' uiOutput("uiExample")
#' )
#' )
#' ),
#' server =
#' function(input, output, session) {
#' output$distPlot <- renderPlot({
#'
#' # generate bins based on input$bins from ui.R
#' x <- faithful[, 2]
#' bins <- seq(min(x), max(x), length.out = input$bins + 1)
#'
#' # draw the histogram with the specified number of bins
#' hist(x, breaks = bins, col = 'darkgray', border = 'white')
#'
#' })
#' output$uiExample <- renderUI({
#' tags$span(
#' popify(bsButton("pointlessButton", "Button", style = "primary", size = "large"),
#' "A Pointless Button",
#' "This button is pointless. It does not do anything!"),
#' tipify(bsButton("pB2", "Button", style = "inverse", size = "extra-small"),
#' "This button is pointless too!")
#' )
#' })
#' addPopover(session, "distPlot", "Data", content = paste0("
Waiting time between ", #' "eruptions and the duration of the eruption for the Old Faithful geyser ", #' "in Yellowstone National Park, Wyoming, USA.
Azzalini, A. and ", #' "Bowman, A. W. (1990). A look at some data on the Old Faithful geyser. ", #' "Applied Statistics 39, 357-365.
"), trigger = 'click') #' } #') #'\dontrun{ #' runApp(app) #'} #'@templateVar item_name Tooltips_and_Popovers #'@templateVar family_name Tooltips_and_Popovers #'@template footer NULL ## These Functions are common to multiple tooltip and popover functions # Shared functions with really long names... createTooltipOrPopoverOnServer <- function(session, id, type, options) { data <- list(action = "add", type = type, id = id, options = options) session$sendCustomMessage(type = "updateTooltipOrPopover", data) } createTooltipOrPopoverOnUI <- function(id, type, options) { options = paste0("{'", paste(names(options), options, sep = "': '", collapse = "', '"), "'}") bsTag <- shiny::tags$script(shiny::HTML(paste0("$(document).ready(function() {setTimeout(function() {shinyBS.addTooltip('", id, "', '", type, "', ", options, ")}, 500)});"))) htmltools::attachDependencies(bsTag, shinyBSDep) } buildTooltipOrPopoverOptionsList <- function(title, placement, trigger, options, content) { if(is.null(options)) { options = list() } if(!missing(content)) { content <- gsub("'", "'", content, fixed = TRUE) if(is.null(options$content)) { options$content = shiny::HTML(content) } } if(is.null(options$placement)) { options$placement = placement } if(is.null(options$trigger)) { if(length(trigger) > 1) trigger = paste(trigger, collapse = " ") options$trigger = trigger } if(is.null(options$title)) { options$title = title options$title <- gsub("'", "'", options$title, fixed = TRUE) } return(options) } shinyBS/R/bsTypeahead.R 0000644 0001762 0000144 00000003625 15116524450 014417 0 ustar ligges users #'bsTypeahead #' #'\code{bsTypeahead} creates a textinput with type ahead function buttons. #' #'@param inputId Input variable to assign the control's value to #'@param label Display label for the control #'@param value Initial value #'@param choices Array of strings to match against. Can also be JavaScript #' function. Use htmlwidgets::JS() to indicate JavaScript. The length of \code{choices} must no exceed 131370. #'@param items The max number of items to display in the dropdown. Can also be #' set to 'all' #'@param minLength The minimum character length needed before triggering #' autocomplete suggestions. You can set it to 0 so suggestion are shown even #' when there is no text when lookup function is called. #'@seealso \code{\link{updateTypeahead}} #' #'@importFrom shiny tagList #' #'@export bsTypeahead <- function(inputId, label, value = "", choices, items = 8, minLength = 1) { if(!is.null(choices)) { if(length(choices) > 131370) { warning("Due to a limitation of the Bootstrap2 Typeahead JavaScript library the length of 'choices' must not exceed 2 ^ 17 - 2!"); } } if(!'JS_EVAL' %in% class(choices)) { choices <- jsonlite::toJSON(choices); } typeahead <- shiny::tagList( shiny::div(class = 'form-group shiny-input-container', shiny::tags$label(label, `for` = inputId), shiny::tags$input(id = inputId, type="text", class="form-control shiny-bound-input typeahead", "data-provide" = "typeahead", autocomplete="off", value = value), shiny::tags$script(paste0("$('#", inputId, "').typeahead({source: ", choices, ", items: ", items, ", minLength: ", minLength, "})")) ) ) htmltools::attachDependencies(typeahead, typeaheadDep) } shinyBS/R/updateTypeahead.R 0000644 0001762 0000144 00000001622 15116523774 015300 0 ustar ligges users #'updateTypeahead #' #'\code{updateTypeahead} Update a bsTypeahead buttons. #'@param session The session object passed to function given to shinyServer. #'@param inputId Input variable to assign the control's value to #'@param label Display label for the control #'@param value Initial value #'@param choices Array of strings to match against. Can also be JavaScript #' function. Use htmlwidgets::JS() to indicate JavaScript. #'@seealso \code{\link{bsTypeahead}} #'@export updateTypeahead<- function(session, inputId, label=NULL, value=NULL, choices=NULL) { if(!is.null(choices)) { if(length(choices) > 131370) { warning("Due to a limitation of the Bootstrap2 Typeahead JavaScript library the length of 'choices' must not exceed 2 ^ 17 - 2!"); } } data <- dropNulls(list(id = inputId, label=label, value=value, choices=choices)) session$sendCustomMessage("typeaheadUpdate", data) } shinyBS/R/addTooltip.R 0000644 0001762 0000144 00000002123 15116513141 014254 0 ustar ligges users #'addTooltip #' #'\code{addTooltip} is used within the Server logic of an app to add a tooltip to a Shiny #'input or output. #' #'@param session The session object passed to function given to shinyServer. #'@param id The id of the element to attach the tooltip to. #'@param title The content of the tooltip. #'@param placement Where the tooltip should appear relative to its target #'(\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}. #'@param trigger What action should cause the tooltip to appear? (\code{hover}, #'\code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}. #'@param options A named list of additional options to be set on the tooltip. #' #'@templateVar item_name addTooltip #'@templateVar family_name Tooltips_and_Popovers #'@template item_details #'@template footer #'@export addTooltip <- function(session, id, title, placement = "bottom", trigger = "hover", options = NULL) { options <- buildTooltipOrPopoverOptionsList(title, placement, trigger, options) createTooltipOrPopoverOnServer(session, id, "tooltip", options) } shinyBS/R/tagManipulators.R 0000644 0001762 0000144 00000003513 15116513141 015327 0 ustar ligges users addClass <- function(tag, class) { if(!is.null(class)) { tag$attribs$class <- trimws(paste(tag$attribs$class, class), "both") } tag } removeClass <- function(tag, class) { if(!is.null(class) & !is.null(tag$attribs$class)) { cls <- strsplit(tag$attribs$class, " ")[[1]] cls <- cls[cls != class] tag$attribs$class <- paste(cls, collapse = " ") } tag } hasClass <- function(tag, class) { if(!is.null(class) & !is.null(tag$attribs$class)) { class %in% strsplit(tag$attribs$class, " ")[[1]] } else { FALSE } } checkClass <- function(class, include) { if(!include) class <- NULL class } buildClass <- function(prefix, variable) { if(!is.null(variable)) { variable <- paste0(prefix, variable) } variable } addStyles <- function(tag, ..., .dots) { new_styles <- list(...) if(!missing(.dots)) { new_styles <- c(new_styles, .dots) } if(!is.null(tag$attribs$style)) { styles <- parseStyles(tag$attribs$style) } else { styles <- list() } for(i in seq_along(new_styles)) { styles[[names(new_styles)[i]]] <- new_styles[[i]] } tag$attribs$style <- writeStyles(styles) tag } removeStyles <- function(tag, ...) { if(!is.null(tag$attribs$style)) { styleList <- list(...) styles <- parseStyles(tag$attribs$style) styles <- styles[!names(styles) %in% styleList] tag$attribs$style <- writeStyles(styles) } tag } parseStyles <- function(styleString) { styles <- trimws(strsplit(styleString, ";")[[1]]) styles <- strsplit(styles, ":") style_names <- sapply(styles, function(s) trimws(s[1])) styles <- lapply(styles, function(s) trimws(s[2])) names(styles) <- style_names return(styles) } writeStyles <- function(styleList) { paste(names(styleList), styleList, sep = ": ", collapse = "; ") } shinyBS/R/bsButton.R 0000644 0001762 0000144 00000003520 15116513141 013753 0 ustar ligges users #'bsButton #' #'\code{bsButton} is used in your UI script to create customizable action and toggle #'buttons. #' #'@inheritParams shiny::actionButton #'@param style A Bootstrap style to apply to the button. (\code{default}, \code{primary}, #'\code{success}, \code{info}, \code{warning}, or \code{danger}) #'@param size The size of the button (\code{extra-small}, \code{small}, #'\code{default}, or \code{large}) #'@param type The type of button to create. (\code{action} or \code{toggle}) #'@param block \bold{logical} Should the button take the full width of the parent element? #'@param disabled \bold{logical} Should the button be disabled (un-clickable)? #'@param value \bold{logical} If \code{type = "toggle"}, the initial value of the button. #' #'@templateVar item_name bsButton #'@templateVar family_name Buttons #'@template item_details #'@template footer #'@export bsButton <- function(inputId, label, icon = NULL, ..., style = "default", size = "default", type = "action", block = FALSE, disabled = FALSE, value = FALSE) { btn <- shiny::actionButton(inputId, label, icon, ...) if(type == "toggle") { btn <- removeClass(btn, "action-button") btn <- addClass(btn, "sbs-toggle-button") if(value == TRUE) { btn <- addClass(btn, "active") } } if(style != "default") { btn <- removeClass(btn, "btn-default") btn <- addClass(btn, paste0("btn-", style)) } size <- switch(size, "extra-small" = "btn-xs", "small" = "btn-sm", "large" = "btn-lg", "default") if(size != "default") { btn <- addClass(btn, size) } if(block == TRUE) { btn <- addClass(btn, "btn-block") } if(disabled) { btn <- addAttribs(btn, disabled = "disabled") } htmltools::attachDependencies(btn, shinyBSDep) } shinyBS/R/bsAlert.R 0000644 0001762 0000144 00000001250 15116525407 013555 0 ustar ligges users #'bsAlert #' #'\code{bsAlert} creates an anchor point in your UI definition. This anchor point #'is where alerts created in your Server logic will be displayed. #' #'@param anchorId A unique id the identifies the anchor. #'@param inline Logical value, determmines the class of the alert. Defaults to #'TRUE. #' #'@templateVar item_name bsAlert #'@templateVar family_name Alerts #'@template item_details #'@template footer #'@export bsAlert <- function(anchorId, inline = TRUE) { class <- "sbs-alert" if(!inline) class = paste(class, "sbs-alert-hover") bsTag <- shiny::tags$div(class = class, id = anchorId, " ") htmltools::attachDependencies(bsTag, shinyBSDep) } shinyBS/R/Alerts.R 0000644 0001762 0000144 00000005566 15116513141 013421 0 ustar ligges users #'Alerts #' #'Alerts allow you to communicate information to the user on the fly. Standard #'Bootstrap styling options give the user a hint at the type of information #'contained in the Alert. #' #'@section Components: #'There are three functions in the Alerts family: #' \describe{ #' \item{\code{\link{bsAlert}}}{Used in the UI to create an anchor where your #' Alerts will be displayed.} #' \item{\code{\link{createAlert}}}{Used in the Server logic to create #' alerts. This would be used within a reactive context to display error #' or success messages to the user based on the status of that context.} #' \item{\code{\link{closeAlert}}}{Used in the Server logic to close an alert #' that is already open. By default, Alerts are dismissable by the user, #' but this offers you a way to close them programmatically.} #' } #' #'@details #'To create alerts in your Shiny app you must place \code{bsAlert} in your ui. #'This serves as an anchor that tells shinyBS where to place the alerts created #'with \code{createAlert}. #' #'Use \code{createAlert} in your server script to add alerts to the anchor #'you created with \code{bsAlert} in your ui. You can place \code{createAlert} #'in observers, reactives, or outputs. A common usage may be to have logic that #'validates a user's inputs. If they are valid produce the requested output, if #'not use \code{createAlert} to give the user info about what they need to #'change. #' #'@section Changes: #'\code{style} was called \code{type} in previous versions of shinyBS. #' #'\code{anchorId} was called \code{inputId} in previous versions of shinyBS. #' #'\code{content} was called \code{message} in previous versions of shinyBS. #' #'@examples #' #'library(shiny) #'library(shinyBS) #'app = shinyApp( #' ui = #' fluidPage( #' sidebarLayout( #' sidebarPanel(textInput("num1", NULL, value = 100), #' "divided by", textInput("num2", NULL, value = 20), #' "equals", textOutput("exampleOutput")), #' mainPanel( #' bsAlert("alert") #' ) #' ) #' ), #' server = #' function(input, output, session) { #' output$exampleOutput <- renderText({ #' num1 <- as.numeric(input$num1) #' num2 <- as.numeric(input$num2) #' #' if(is.na(num1) | is.na(num2)) { #' createAlert(session, "alert", "exampleAlert", title = "Oops", #' content = "Both inputs should be numeric.", append = FALSE) #' } else if(num2 == 0) { #' createAlert(session, "alert", "exampleAlert", title = "Oops", #' content = "You cannot divide by 0.", append = FALSE) #' } else { #' closeAlert(session, "exampleAlert") #' return(num1/num2) #' } #' #' }) #' } #') #' #'\dontrun{ #' runApp(app) #'} #'@templateVar item_name Alerts #'@templateVar family_name Alerts #'@template footer NULL shinyBS/R/bsExample.R 0000644 0001762 0000144 00000002521 15116525723 014104 0 ustar ligges users #'bsExample #' #'A function to view examples of shinyBS functionality. Will run the examples #'found in the examples sections of shinyBS documentation. Use this instead of #'\code{example}. #' #'@param family A shinyBS family name #'@param display.mode The display mode to use when running the example. See #'\code{\link[shiny:runApp]{runApp}}. #'@param \dots Other parameters to pass to \code{\link[shiny:runApp]{runApp}}. #' #'@details #'This function is just a wrapper for \code{\link[shiny:runApp]{runApp}} that runs copies of the #'examples found in the family documention pages of \code{shinyBS}. By default, #'\code{display.mode} is set to \code{showcase} so you can see the code while #'the app is running. #' #'@examples #'\dontrun{ #' bsExample("Alerts")} #'@export bsExample <- function(family, display.mode = "showcase", ...) { exp <- system.file("examples", package="shinyBS") fams <- list.dirs(exp, full.names = FALSE, recursive = FALSE) appname <- gsub(" ", "", family, fixed = TRUE) appname <- gsub("_", "", appname, fixed = TRUE) if(appname %in% fams) { appname <- normalizePath(paste0(exp, "/", appname)) shiny::runApp(appname, display.mode = display.mode, ...) } else { stop("Could not find shinyBS family: ", family, "\nAvailable families are: ", paste0(fams, collapse = ", ")) } } shinyBS/R/addPopover.R 0000644 0001762 0000144 00000002221 15116513141 014253 0 ustar ligges users #'addPopover #' #'\code{addPopover} is used within the Server logic of an app to add a popover to a Shiny #'input or output. #' #'@param session The session object passed to function given to shinyServer. #'@param id The id of the element to attach the popover to. #'@param title The title of the popover. #'@param content The main content of the popover. #'@param placement Where the popover should appear relative to its target #'(\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{bottom}. #'@param trigger What action should cause the popover to appear? (\code{hover}, #'\code{focus}, \code{click}, or \code{manual}). Defaults to \code{hover}. #'@param options A named list of additional options to be set on the popover. #' #'@templateVar item_name addPopover #'@templateVar family_name Tooltips_and_Popovers #'@template item_details #'@template footer #'@export addPopover <- function(session, id, title, content, placement = "bottom", trigger = "hover", options = NULL) { options <- buildTooltipOrPopoverOptionsList(title, placement, trigger, options, content) createTooltipOrPopoverOnServer(session, id, "popover", options) } shinyBS/R/bsPopover.R 0000644 0001762 0000144 00000002042 15116513141 014130 0 ustar ligges users #'bsPopover #' #'\code{bsPopover} is used within the UI of an app to add a popover to a Shiny #'input or output. #' #'@param id The id of the element to attach the popover to. #'@param title The title of the popover. #'@param content The main content of the popover. #'@param placement Where the popover should appear relative to its target #'(\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}. #'@param trigger What action should cause the popover to appear? (\code{hover}, #'\code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}. #'@param options A named list of additional options to be set on the popover. #' #'@templateVar item_name bsPopover #'@templateVar family_name Tooltips_and_Popovers #'@template item_details #'@template footer #'@export bsPopover <- function(id, title, content, placement="bottom", trigger="hover", options = NULL) { options = buildTooltipOrPopoverOptionsList(title, placement, trigger, options, content) createTooltipOrPopoverOnUI(id, "popover", options) } shinyBS/R/popify.R 0000644 0001762 0000144 00000002470 15116525647 013502 0 ustar ligges users #'popify #' #'\code{popify} can be wrapped around any shiny UI element to add a popover to the #'wrapped element. This should be a safer way to add popovers to elements created with #'\code{\link[shiny:renderUI]{renderUI}}. #' #'@param el A shiny UI element. #'@param title The title of the popover. #'@param content The main content of the popover. #'@param placement Where the popover should appear relative to its target #'(\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}. #'@param trigger What action should cause the popover to appear? (\code{hover}, #'\code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}. #'@param options A named list of additional options to be set on the popover. #' #'@templateVar item_name popify #'@templateVar family_name Tooltips_and_Popovers #'@template item_details #'@template footer #'@export popify <- function(el, title, content, placement="bottom", trigger="hover", options = NULL) { id <- el$attribs$id if(is.null(id)) { id <- paste0("tipify", as.integer(runif(1, 1, 10000000))) el <- addAttribs(el, id = id) } options = buildTooltipOrPopoverOptionsList(title, placement, trigger, options, content) script <- createTooltipOrPopoverOnUI(id, "popover", options) return(shiny::tagList(el, script)) } shinyBS/R/bsCollapsePanel.R 0000644 0001762 0000144 00000003066 15116513141 015227 0 ustar ligges users #'bsCollapsePanel #' #'\code{bsCollapsePanel} creates individual panels within a \code{\link{bsCollapse}} object. #' #'@param title The title to display at the top of the panel. #'@param \dots UI elements to include within the panel. #'@param value \bold{Optional} The value to return when this panel is open. Defaults to \code{title}. #'@param style \bold{Optional} A Bootstrap style to apply to the panel. (\code{primary}, \code{danger}, \code{warning}, \code{info}, or \code{success}) #' #'@templateVar item_name bsCollapsePanel #'@templateVar family_name Collapses #'@template item_details #'@template footer #'@export bsCollapsePanel <- function(title, ..., value = title, style = NULL) { content <- list(...) id <- paste0("cpanel", sprintf("%07i", as.integer(stats::runif(1, 1, 1000000)))) if(is.null(value)) { value = title } if(is.null(style)) { style = "default" } bsTag <- shiny::tags$div(class = paste0("panel panel-", style), value = value, shiny::tags$div(class = "panel-heading", role = "tab", id = paste0("heading_", id), shiny::tags$h4(class = "panel-title", shiny::tags$a("data-toggle" = "collapse", href = paste0("#", id), title) ) ), shiny::tags$div(id = id, class = "panel-collapse collapse", role = "tabpanel", shiny::tags$div(class = "panel-body", content) ) ) htmltools::attachDependencies(bsTag, shinyBSDep) } shinyBS/R/tipify.R 0000644 0001762 0000144 00000002365 15116525647 013503 0 ustar ligges users #'tipify #' #'\code{tipify} can be wrapped around any shiny UI element to add a tooltip to the #'wrapped element. This should be a safer way to add tooltips to elements created with #'\code{\link[shiny:renderUI]{renderUI}}. #' #'@param el A shiny UI element. #'@param title The content of the tooltip. #'@param placement Where the tooltip should appear relative to its target #'(\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}. #'@param trigger What action should cause the tooltip to appear? (\code{hover}, #'\code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}. #'@param options A named list of additional options to be set on the tooltip. #' #'@templateVar item_name tipify #'@templateVar family_name Tooltips_and_Popovers #'@template item_details #'@template footer #'@export tipify <- function(el, title, placement="bottom", trigger="hover", options = NULL) { id <- el$attribs$id if(is.null(id)) { id <- paste0("tipify", as.integer(runif(1, 1, 10000000))) el <- addAttribs(el, id = id) } options = buildTooltipOrPopoverOptionsList(title, placement, trigger, options) script <- createTooltipOrPopoverOnUI(id, "tooltip", options) return(shiny::tagList(el, script)) } shinyBS/R/toggleModal.R 0000644 0001762 0000144 00000001123 15116513141 014406 0 ustar ligges users #'toggleModal #' #'\code{toggleModal} is used within your Server logic to open or close a modal #'window. #' #'@param session The session object passed to function given to shinyServer. #'@param modalId The id of the modal window you want to open/close #'@param toggle Should the modal window \code{open}, \code{close}, or \code{toggle}? #' #'@templateVar item_name toggleModal #'@templateVar family_name Modals #'@template item_details #'@template footer #'@export toggleModal <- function(session, modalId, toggle = "toggle") { session$sendInputMessage(modalId, list(toggle = toggle)) } shinyBS/NAMESPACE 0000644 0001762 0000144 00000000765 15116524506 013065 0 ustar ligges users # Generated by roxygen2: do not edit by hand export(addPopover) export(addTooltip) export(bsAlert) export(bsButton) export(bsCollapse) export(bsCollapsePanel) export(bsExample) export(bsModal) export(bsPopover) export(bsTooltip) export(bsTypeahead) export(closeAlert) export(createAlert) export(popify) export(removePopover) export(removeTooltip) export(tipify) export(toggleModal) export(updateButton) export(updateCollapse) export(updateTypeahead) importFrom(shiny,tagList) importFrom(stats,runif) shinyBS/NEWS.md 0000644 0001762 0000144 00000000251 15154257254 012737 0 ustar ligges users # shinyBS 0.64.0 * Included a fix for a broken `bsModal`, which broke upon Shiny >= 1.12.1 # shinyBS 0.63.0 * Added a `NEWS.md` file to track changes to the package. shinyBS/inst/ 0000755 0001762 0000144 00000000000 15116513141 012604 5 ustar ligges users shinyBS/inst/tests/ 0000755 0001762 0000144 00000000000 15116513141 013746 5 ustar ligges users shinyBS/inst/tests/tipify_test2.R 0000644 0001762 0000144 00000003330 15116513141 016515 0 ustar ligges users library(shiny) library(shinyBS) app <- shinyApp( ui = fluidPage( sidebarLayout( sidebarPanel(HTML("This button will open Panel 1 usingupdateCollapse."),
actionButton("p1Button", "Push Me!"),
selectInput("styleSelect", "Select style for Panel 1",
c("default", "primary", "danger", "warning", "info", "success"))
),
mainPanel(
bsCollapse(id = "collapseExample", open = "Panel 2",
bsCollapsePanel("Panel 1", "This is a panel with just text ",
"and has the default style. You can change the style in ",
"the sidebar.", style = "info"),
bsCollapsePanel("Panel 2", "This panel has a generic plot. ",
"and a 'success' style.", plotOutput("genericPlot"), style = "success")
),
uiOutput("tooltip_test"),
actionButton("test2", "Test2"),
bsTooltip("test2", title = "Test2", placement="right"),
tipify(tags$button("Hello"), "Test without ID")
)
)
),
server =
function(input, output, session) {
output$genericPlot <- renderPlot(plot(rnorm(100)))
observeEvent(input$p1Button, ({
updateCollapse(session, "collapseExample", open = "Panel 1")
}))
observeEvent(input$styleSelect, ({
updateCollapse(session, "collapseExample", style = list("Panel 1" = input$styleSelect))
}))
output$tooltip_test <- renderUI({
tipify(actionButton("test", "Test"), title = "test", placement = "right")
})
}
)
runApp(app) shinyBS/inst/tests/tipify_test.R 0000644 0001762 0000144 00000002061 15116513141 016433 0 ustar ligges users library(shiny)
library(shinyBS)
shinyApp(
ui =
fluidPage(
tabsetPanel(
tabPanel("Tab #1",
plotOutput("genericPlot")
),
tabPanel("Tab #2",
checkboxInput("showOptions", "Show Options"),
uiOutput("ui_multiview_customize"),
plotOutput("multiview_plot")
)
)
),
server =
function(input, output, session) {
output$genericPlot <- renderPlot(plot(rnorm(1000)))
output$multiview_plot <- renderPlot(plot(runif(1000)))
output$ui_multiview_customize <- renderUI({
if(input$showOptions) {
bsCollapse(
bsCollapsePanel(title = "View Options",
checkboxInput("multiview_checkbox", label = "Include warmup", value = FALSE),
hr(),
tipify(downloadButton("download_multiview", "Save as ggplot2 objects"),
title = "Save ggplot2 object in .RData file.", placement="right")
)
)
}
})
}
)
shinyBS/inst/www/ 0000755 0001762 0000144 00000000000 15156520320 013431 5 ustar ligges users shinyBS/inst/www/shinyBS.js 0000644 0001762 0000144 00000020022 15156520320 015342 0 ustar ligges users var shinyBS = {inputBindings: {}};
shinyBS.inputBindings.toggle = new Shiny.InputBinding();
$.extend(shinyBS.inputBindings.toggle, {
find: function(scope) {
return $(scope).find(".sbs-toggle-button");
},
getValue: function(el) {
return $(el).hasClass("active");
},
subscribe: function(el, callback) {
$(el).on("click", function(e) {
$(el).toggleClass("active").blur();
callback();
})
},
unsubscribe: function(el) {
$(el).off("click");
}
});
Shiny.inputBindings.register(shinyBS.inputBindings.toggle)
shinyBS.inputBindings.modal = new Shiny.InputBinding();
$.extend(shinyBS.inputBindings.modal, {
find: function(scope) {
return $(scope).find(".sbs-modal");
},
getValue: function(el) {
return $(el).hasClass("in");
},
subscribe: function(el, callback) {
$(el).on("hidden.bs.modal shown.bs.modal", () => callback(true));
},
unsubscribe: function(el) {
$(el).off("hidden.bs.modal shown.bs.modal")
},
receiveMessage: function(el, data) {
if(data.hasOwnProperty("toggle")) {
if(data.toggle == "show") {
$(el).modal("show");
} else if(data.toggle == "hide") {
$(el).modal("hide");
} else {
$(el).modal("toggle");
}
};
},
initialize: function(el) {
$("#" + $(el).attr("data-sbs-trigger")).attr({"data-toggle": "modal", "data-target": "#" + $(el).attr("id")});
}
});
Shiny.inputBindings.register(shinyBS.inputBindings.modal);
shinyBS.inputBindings.collapse = new Shiny.InputBinding();
$.extend(shinyBS.inputBindings.collapse, {
find: function(scope) {
return $(scope).find(".sbs-panel-group");
},
getValue: function(el) {
return $(el).data("sbs-value");
},
receiveMessage: function(el, data) {
var $el = $(el);
/* I would think this code should work, but it doesn't for some reason so I am
commenting it out.
if(data.hasOwnProperty('multiple')) {
if(data.multiple) {
$el.find(".collapse").each(function(i) {$(this).collapse({parent: false, toggle: false})});
} else {
$el.find(".collapse").each(function(i) {$(this).collapse({parent: "#"+$el.attr("id"), toggle: false})});
}
}
*/
if(data.hasOwnProperty('style')) {
var panels = Object.keys(data.style)
for(var i = 0; i < panels.length; i++) {
var $p = $el.find("div[value='" + panels[i] + "']")
$p
.removeClass("panel-primary panel-danger panel-warning panel-error panel-info panel-success")
.addClass("panel-" + data.style[panels[i]]);
}
}
if(data.hasOwnProperty('open')) {
if(!Array.isArray(data.open)) {
data.open = [data.open]
}
data.open.forEach(function(value, index, array) {
$el.find("div[value='" + value + "'] > .panel-collapse").collapse("show");
})
}
if(data.hasOwnProperty("close")) {
if(!Array.isArray(data.close)) {
data.close = [data.close];
}
data.close.forEach(function(value, index, array) {
$el.find("div[value='" + value + "'] > .panel-collapse").collapse("hide");
})
}
},
subscribe: function(el, callback) {
$(el).find(".collapse").on("shown.bs.collapse hidden.bs.collapse", () => callback(true));
},
initialize: function(el) {
var $el = $(el);
var $panels = $el.children(".panel");
var val = [];
$panels.each(function(i) {
if($(this).children("div.panel-collapse.collapse").hasClass("in")) {
val.push($(this).attr("value"));
}
var $pan = $(this).children("div.panel-collapse.collapse");
if($el.attr("data-sbs-multi") == "FALSE") {
var par = "#" + $el.attr("id");
} else {
var par = false;
}
$pan.collapse({parent: par, toggle: false});
});
$el.data("sbs-value", val);
$panels.on("show.bs.collapse", function(event) {
var val = $el.data("sbs-value");
val.push($(this).attr("value"));
$el.data("sbs-value", val)
});
$panels.on("hide.bs.collapse", function(event) {
var val = $el.data("sbs-value");
var i = val.indexOf($(this).attr("value"))
if(i != -1) {
val.splice(i, 1);
$el.data("sbs-value", val);
}
});
}
})
Shiny.inputBindings.register(shinyBS.inputBindings.collapse);
Shiny.addCustomMessageHandler("bsAlertCreate", function(data) {
var create = true;
if(data.hasOwnProperty("alertId")) {
if($("#" + data.alertId).length > 0) {
create = false;
}
}
if(create) {
var $alert = $("");
if(data.hasOwnProperty('style')) {
$alert.addClass("alert-" + data.style);
} else {
$alert.addClass("alert-info");
}
if(data.hasOwnProperty("dismiss")) {
$alert.addClass("alert-dismissable");
}
if(data.hasOwnProperty("alertId")) {
$alert.attr("id", data.alertId);
}
if(data.hasOwnProperty('dismiss')) {
if(data.dismiss == true) {
$alert.append("")
}
}
if(data.hasOwnProperty('title')) {
$alert.append("Waiting time between ", "eruptions and the duration of the eruption for the Old Faithful geyser ", "in Yellowstone National Park, Wyoming, USA.
Azzalini, A. and ", "Bowman, A. W. (1990). A look at some data on the Old Faithful geyser. ", "Applied Statistics 39, 357-365.
"), trigger = 'click') } ) shinyBS/inst/examples/Collapses/ 0000755 0001762 0000144 00000000000 15116513141 016347 5 ustar ligges users shinyBS/inst/examples/Collapses/ui.R 0000644 0001762 0000144 00000001530 15116513141 017106 0 ustar ligges users library(shiny) library(shinyBS) fluidPage( sidebarLayout( sidebarPanel(HTML("This button will open Panel 1 usingupdateCollapse."),
actionButton("p1Button", "Push Me!"),
selectInput("styleSelect", "Select style for Panel 1",
c("default", "primary", "danger", "warning", "info", "success"))
),
mainPanel(
bsCollapse(id = "collapseExample", open = "Panel 2",
bsCollapsePanel("Panel 1", "This is a panel with just text ",
"and has the default style. You can change the style in ",
"the sidebar.", style = "info"),
bsCollapsePanel("Panel 2", "This panel has a generic plot. ",
"and a 'success' style.", plotOutput("genericPlot"), style = "success")
)
)
)
)
shinyBS/inst/examples/Collapses/server.R 0000644 0001762 0000144 00000000602 15116513141 017776 0 ustar ligges users library(shiny)
library(shinyBS)
shinyServer(
function(input, output, session) {
output$genericPlot <- renderPlot(plot(rnorm(100)))
observeEvent(input$p1Button, ({
updateCollapse(session, "collapseExample", open = "Panel 1")
}))
observeEvent(input$styleSelect, ({
updateCollapse(session, "collapseExample", style = list("Panel 1" = input$styleSelect))
}))
}
)
shinyBS/inst/examples/Alerts/ 0000755 0001762 0000144 00000000000 15116513141 015654 5 ustar ligges users shinyBS/inst/examples/Alerts/ui.R 0000644 0001762 0000144 00000000450 15116513141 016413 0 ustar ligges users library(shiny)
library(shinyBS)
fluidPage(
sidebarLayout(
sidebarPanel(textInput("num1", NULL, value = 100),
"divided by", textInput("num2", NULL, value = 20),
"equals", textOutput("exampleOutput")),
mainPanel(
bsAlert("alert")
)
)
)
shinyBS/inst/examples/Alerts/server.R 0000644 0001762 0000144 00000001225 15116513141 017305 0 ustar ligges users library(shiny)
library(shinyBS)
shinyServer(
function(input, output, session) {
output$exampleOutput <- renderText({
num1 <- as.numeric(input$num1)
num2 <- as.numeric(input$num2)
if(is.na(num1) | is.na(num2)) {
createAlert(session, "alert", "exampleAlert", title = "Oops",
content = "Both inputs should be numeric.", append = FALSE)
} else if(num2 == 0) {
createAlert(session, "alert", "exampleAlert", title = "Oops",
content = "You cannot divide by 0.", append = FALSE)
} else {
closeAlert(session, "exampleAlert")
return(num1/num2)
}
})
}
)
shinyBS/inst/examples/Buttons/ 0000755 0001762 0000144 00000000000 15116513141 016060 5 ustar ligges users shinyBS/inst/examples/Buttons/ui.R 0000644 0001762 0000144 00000001371 15116513141 016622 0 ustar ligges users library(shiny)
library(shinyBS)
fluidPage(
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Move the slider to see its effect on the button below:",
min = 1,
max = 50,
value = 1),
bsButton("actTwo", label = "Click me if you dare!", icon = icon("ban")),
tags$p("Clicking the first button below changes the disabled state of the second button."),
bsButton("togOne", label = "Toggle button disabled status",
block = TRUE, type = "toggle", value = TRUE),
bsButton("actOne", label = "Block Action Button", block = TRUE)
),
mainPanel(
textOutput("exampleText")
)
)
)
shinyBS/inst/examples/Buttons/server.R 0000644 0001762 0000144 00000002162 15116513141 017512 0 ustar ligges users library(shiny)
library(shinyBS)
shinyServer(
function(input, output, session) {
observeEvent(input$togOne, ({
updateButton(session, "actOne", disabled = !input$togOne)
}))
observeEvent(input$bins, ({
b <- input$bins
disabled = NULL
style = "default"
icon = ""
if(b < 5) {
disabled = TRUE
icon <- icon("ban")
} else {
disabled = FALSE
}
if(b < 15 | b > 35) {
style = "danger"
} else if(b < 20 | b > 30) {
style = "warning"
} else {
style = "default"
icon = icon("check")
}
updateButton(session, "actTwo", disabled = disabled, style = style, icon = icon)
}))
output$exampleText <- renderText({
input$actTwo
b <- isolate(input$bins)
txt = ""
if((b > 5 & b < 15) | b > 35) {
txt = "That was dangerous."
} else if((b > 5 & b < 20) | b > 30) {
txt = "I warned you about that."
} else if(b >= 20 & b <= 30) {
txt = "You have chosen... wisely."
}
return(txt)
})
}
)
shinyBS/inst/examples/Modals/ 0000755 0001762 0000144 00000000000 15116513141 015641 5 ustar ligges users shinyBS/inst/examples/Modals/ui.R 0000644 0001762 0000144 00000000714 15116513141 016403 0 ustar ligges users library(shiny)
library(shinyBS)
fluidPage(
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30),
actionButton("tabBut", "View Table")
),
mainPanel(
plotOutput("distPlot"),
bsModal("modalExample", "Data Table", "tabBut", size = "large",
dataTableOutput("distTable"))
)
)
)
shinyBS/inst/examples/Modals/server.R 0000644 0001762 0000144 00000001603 15116513141 017272 0 ustar ligges users library(shiny)
library(shinyBS)
shinyServer(
function(input, output, session) {
output$distPlot <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
output$distTable <- renderDataTable({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
tab <- hist(x, breaks = bins, plot = FALSE)
tab$breaks <- sapply(seq(length(tab$breaks) - 1), function(i) {
paste0(signif(tab$breaks[i], 3), "-", signif(tab$breaks[i+1], 3))
})
tab <- as.data.frame(do.call(cbind, tab))
colnames(tab) <- c("Bins", "Counts", "Density")
return(tab[, 1:3])
}, options = list(pageLength=10))
}
)
shinyBS/man/ 0000755 0001762 0000144 00000000000 15120510337 012401 5 ustar ligges users shinyBS/man/bsCollapse.Rd 0000644 0001762 0000144 00000002347 15120510337 014765 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bsCollapse.R
\name{bsCollapse}
\alias{bsCollapse}
\title{bsCollapse}
\usage{
bsCollapse(..., id = NULL, multiple = FALSE, open = NULL)
}
\arguments{
\item{\dots}{\code{\link{bsCollapsePanel}} elements to include in the Collapse.}
\item{id}{\bold{Optional} You can use \code{input$id} in your Server logic to
determine which panels are open, and \code{\link{updateCollapse}} to open/close
panels.}
\item{multiple}{Can more than one panel be open at a time? Defaults to \code{FALSE}.}
\item{open}{The \code{value}, (or if none was supplied, the \code{title}) of
the panel(s) you want open on load.}
}
\description{
\code{bsCollapse} is used in your UI to create a collapse panel group. Use
\code{\link{bsCollapsePanel}} to populate this object with panels.
}
\details{
See \link{Collapses} for more information about how to use \code{bsCollapse} with the
rest of the Collapses family.
}
\note{
Run \code{bsExample("Collapses")} for an example
of \code{bsCollapse} functionality.
}
\seealso{
\href{https://getbootstrap.com}{Twitter Bootstrap 3}
Other Collapses:
\code{\link{Collapses}},
\code{\link{bsCollapsePanel}()},
\code{\link{updateCollapse}()}
}
\concept{Collapses}
shinyBS/man/Collapses.Rd 0000644 0001762 0000144 00000005653 15120510337 014626 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Collapses.R
\name{Collapses}
\alias{Collapses}
\title{Collapses}
\description{
Collapse panels allow you to reduce clutter in your Shiny app by making
panels of information that open and close with a user's click. Any type of
content can go in a collapse panel. Standard Bootstrap styling options are
available.
}
\details{
Collapses are designed to mimic \code{\link[shiny:tabsetPanel]{tabsetPanel}} in their implementation.
Start with \code{bsCollapse} to create a panel group, then fill it with panels
using \code{bsCollapsePanel}.
\code{bsCollapse} acts as an input, so you can retrieve which panels are open
from the input object passed to the function in \code{\link[shiny:shinyServer]{shinyServer}}.
\code{updateCollapse} can be used within your server logic to open/close
collapse panels or to change their style.
}
\note{
Run \code{bsExample("Collapses")} for an example
of \code{Collapses} functionality.
}
\section{Components}{
\describe{
\item{\code{\link{bsCollapse}}}{A container for holder the individual panels created by \code{\link{bsCollapsePanel}}.}
\item{\code{\link{bsCollapsePanel}}}{Creates an individual Collapse Panel that resides within a \code{\link{bsCollapse}}.}
\item{\code{\link{updateCollapse}}}{Used within your server logic to open/close collapse panels or change their style.}
}
}
\section{Changes}{
\code{style} is a new option that wasn't available in previous versions of
shinyBS.
}
\examples{
library(shiny)
library(shinyBS)
app = shinyApp(
ui =
fluidPage(
sidebarLayout(
sidebarPanel(HTML("This button will open Panel 1 using updateCollapse."),
actionButton("p1Button", "Push Me!"),
selectInput("styleSelect", "Select style for Panel 1",
c("default", "primary", "danger", "warning", "info", "success"))
),
mainPanel(
bsCollapse(id = "collapseExample", open = "Panel 2",
bsCollapsePanel("Panel 1", "This is a panel with just text ",
"and has the default style. You can change the style in ",
"the sidebar.", style = "info"),
bsCollapsePanel("Panel 2", "This panel has a generic plot. ",
"and a 'success' style.", plotOutput("genericPlot"), style = "success")
)
)
)
),
server =
function(input, output, session) {
output$genericPlot <- renderPlot(plot(rnorm(100)))
observeEvent(input$p1Button, ({
updateCollapse(session, "collapseExample", open = "Panel 1")
}))
observeEvent(input$styleSelect, ({
updateCollapse(session, "collapseExample", style = list("Panel 1" = input$styleSelect))
}))
}
)
\dontrun{
runApp(app)
}
}
\seealso{
\href{https://getbootstrap.com}{Twitter Bootstrap 3}
Other Collapses:
\code{\link{bsCollapse}()},
\code{\link{bsCollapsePanel}()},
\code{\link{updateCollapse}()}
}
\concept{Collapses}
shinyBS/man/popify.Rd 0000644 0001762 0000144 00000003103 15120510337 014173 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/popify.R
\name{popify}
\alias{popify}
\title{popify}
\usage{
popify(
el,
title,
content,
placement = "bottom",
trigger = "hover",
options = NULL
)
}
\arguments{
\item{el}{A shiny UI element.}
\item{title}{The title of the popover.}
\item{content}{The main content of the popover.}
\item{placement}{Where the popover should appear relative to its target
(\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}.}
\item{trigger}{What action should cause the popover to appear? (\code{hover},
\code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}.}
\item{options}{A named list of additional options to be set on the popover.}
}
\description{
\code{popify} can be wrapped around any shiny UI element to add a popover to the
wrapped element. This should be a safer way to add popovers to elements created with
\code{\link[shiny:renderUI]{renderUI}}.
}
\details{
See \link{Tooltips_and_Popovers} for more information about how to use \code{popify} with the
rest of the Tooltips_and_Popovers family.
}
\note{
Run \code{bsExample("Tooltips_and_Popovers")} for an example
of \code{popify} functionality.
}
\seealso{
\href{https://getbootstrap.com}{Twitter Bootstrap 3}
Other Tooltips_and_Popovers:
\code{\link{Tooltips_and_Popovers}},
\code{\link{addPopover}()},
\code{\link{addTooltip}()},
\code{\link{bsPopover}()},
\code{\link{bsTooltip}()},
\code{\link{removePopover}()},
\code{\link{removeTooltip}()},
\code{\link{tipify}()}
}
\concept{Tooltips_and_Popovers}
shinyBS/man/toggleModal.Rd 0000644 0001762 0000144 00000001620 15120510337 015125 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/toggleModal.R
\name{toggleModal}
\alias{toggleModal}
\title{toggleModal}
\usage{
toggleModal(session, modalId, toggle = "toggle")
}
\arguments{
\item{session}{The session object passed to function given to shinyServer.}
\item{modalId}{The id of the modal window you want to open/close}
\item{toggle}{Should the modal window \code{open}, \code{close}, or \code{toggle}?}
}
\description{
\code{toggleModal} is used within your Server logic to open or close a modal
window.
}
\details{
See \link{Modals} for more information about how to use \code{toggleModal} with the
rest of the Modals family.
}
\note{
Run \code{bsExample("Modals")} for an example
of \code{toggleModal} functionality.
}
\seealso{
\href{https://getbootstrap.com}{Twitter Bootstrap 3}
Other Modals:
\code{\link{Modals}},
\code{\link{bsModal}()}
}
\concept{Modals}
shinyBS/man/tipify.Rd 0000644 0001762 0000144 00000002774 15120510337 014206 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tipify.R
\name{tipify}
\alias{tipify}
\title{tipify}
\usage{
tipify(el, title, placement = "bottom", trigger = "hover", options = NULL)
}
\arguments{
\item{el}{A shiny UI element.}
\item{title}{The content of the tooltip.}
\item{placement}{Where the tooltip should appear relative to its target
(\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}.}
\item{trigger}{What action should cause the tooltip to appear? (\code{hover},
\code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}.}
\item{options}{A named list of additional options to be set on the tooltip.}
}
\description{
\code{tipify} can be wrapped around any shiny UI element to add a tooltip to the
wrapped element. This should be a safer way to add tooltips to elements created with
\code{\link[shiny:renderUI]{renderUI}}.
}
\details{
See \link{Tooltips_and_Popovers} for more information about how to use \code{tipify} with the
rest of the Tooltips_and_Popovers family.
}
\note{
Run \code{bsExample("Tooltips_and_Popovers")} for an example
of \code{tipify} functionality.
}
\seealso{
\href{https://getbootstrap.com}{Twitter Bootstrap 3}
Other Tooltips_and_Popovers:
\code{\link{Tooltips_and_Popovers}},
\code{\link{addPopover}()},
\code{\link{addTooltip}()},
\code{\link{bsPopover}()},
\code{\link{bsTooltip}()},
\code{\link{popify}()},
\code{\link{removePopover}()},
\code{\link{removeTooltip}()}
}
\concept{Tooltips_and_Popovers}
shinyBS/man/addPopover.Rd 0000644 0001762 0000144 00000003146 15120510337 014777 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/addPopover.R
\name{addPopover}
\alias{addPopover}
\title{addPopover}
\usage{
addPopover(
session,
id,
title,
content,
placement = "bottom",
trigger = "hover",
options = NULL
)
}
\arguments{
\item{session}{The session object passed to function given to shinyServer.}
\item{id}{The id of the element to attach the popover to.}
\item{title}{The title of the popover.}
\item{content}{The main content of the popover.}
\item{placement}{Where the popover should appear relative to its target
(\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{bottom}.}
\item{trigger}{What action should cause the popover to appear? (\code{hover},
\code{focus}, \code{click}, or \code{manual}). Defaults to \code{hover}.}
\item{options}{A named list of additional options to be set on the popover.}
}
\description{
\code{addPopover} is used within the Server logic of an app to add a popover to a Shiny
input or output.
}
\details{
See \link{Tooltips_and_Popovers} for more information about how to use \code{addPopover} with the
rest of the Tooltips_and_Popovers family.
}
\note{
Run \code{bsExample("Tooltips_and_Popovers")} for an example
of \code{addPopover} functionality.
}
\seealso{
\href{https://getbootstrap.com}{Twitter Bootstrap 3}
Other Tooltips_and_Popovers:
\code{\link{Tooltips_and_Popovers}},
\code{\link{addTooltip}()},
\code{\link{bsPopover}()},
\code{\link{bsTooltip}()},
\code{\link{popify}()},
\code{\link{removePopover}()},
\code{\link{removeTooltip}()},
\code{\link{tipify}()}
}
\concept{Tooltips_and_Popovers}
shinyBS/man/bsTypeahead.Rd 0000644 0001762 0000144 00000001744 15116524126 015135 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bsTypeahead.R
\name{bsTypeahead}
\alias{bsTypeahead}
\title{bsTypeahead}
\usage{
bsTypeahead(inputId, label, value = "", choices, items = 8, minLength = 1)
}
\arguments{
\item{inputId}{Input variable to assign the control's value to}
\item{label}{Display label for the control}
\item{value}{Initial value}
\item{choices}{Array of strings to match against. Can also be JavaScript
function. Use htmlwidgets::JS() to indicate JavaScript. The length of \code{choices} must no exceed 131370.}
\item{items}{The max number of items to display in the dropdown. Can also be
set to 'all'}
\item{minLength}{The minimum character length needed before triggering
autocomplete suggestions. You can set it to 0 so suggestion are shown even
when there is no text when lookup function is called.}
}
\description{
\code{bsTypeahead} creates a textinput with type ahead function buttons.
}
\seealso{
\code{\link{updateTypeahead}}
}
shinyBS/man/Buttons.Rd 0000644 0001762 0000144 00000007665 15120510337 014344 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Buttons.R
\name{Buttons}
\alias{Buttons}
\title{Buttons}
\description{
Twitter Bootstrap gives many options for styling buttons that aren't made
available by standard Shiny. Use shinyBS to create buttons of different sizes,
shapes, and colors.
}
\details{
Create a button in the UI with \code{\link{bsButton}}. If \code{type = "action"}
the button will behave like the standard \code{\link[shiny:actionButton]{actionButton}} in shiny.
If \code{type = "toggle"} the button will behave like a \code{\link[shiny:checkboxInput]{checkboxInput}}
with an on and off state. It will return \code{TRUE} or \code{FALSE} to the Server
depending on its state.
You can update the style and state of a \code{\link{bsButton}} from the Server
logic with \code{\link{updateButton}}. For example, a button could be set to
\code{disabled = TRUE} until the user has made some other selections, then once
those selections have been made, an observer on the Server could use \code{\link{updateButton}}
to enable the button allowing the user to proceed. Alternatively, you could set
the button to \code{style = "success"} to let them know that the button is ready
to be clicked.
}
\note{
Run \code{bsExample("Buttons")} for an example
of \code{Buttons} functionality.
}
\section{Components}{
There are two functions in the Buttons family:
\describe{
\item{\code{\link{bsButton}}}{Used in the UI to create a button. Buttons
can be of the type \code{action} or \code{toggle}.}
\item{\code{\link{updateButton}}}{Used in the Server logic to modify the
state of a button created with \code{\link{bsButton}}}
}
}
\section{Changes}{
\code{bsActionButton} and \code{bsToggleButton} were replaced with just
\code{\link{bsButton}} with a \code{type} argument.
\code{icon} was added to allow placing an icon in the button.
}
\examples{
library(shiny)
library(shinyBS)
app = shinyApp(
ui =
fluidPage(
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Move the slider to see its effect on the button below:",
min = 1,
max = 50,
value = 1),
bsButton("actTwo", label = "Click me if you dare!", icon = icon("ban")),
tags$p("Clicking the first button below changes the disabled state of the second button."),
bsButton("togOne", label = "Toggle button disabled status",
block = TRUE, type = "toggle", value = TRUE),
bsButton("actOne", label = "Block Action Button", block = TRUE)
),
mainPanel(
textOutput("exampleText")
)
)
),
server =
function(input, output, session) {
observeEvent(input$togOne, ({
updateButton(session, "actOne", disabled = !input$togOne)
}))
observeEvent(input$bins, ({
b <- input$bins
disabled = NULL
style = "default"
icon = ""
if(b < 5) {
disabled = TRUE
icon <- icon("ban")
} else {
disabled = FALSE
}
if(b < 15 | b > 35) {
style = "danger"
} else if(b < 20 | b > 30) {
style = "warning"
} else {
style = "default"
icon = icon("check")
}
updateButton(session, "actTwo", disabled = disabled, style = style, icon = icon)
}))
output$exampleText <- renderText({
input$actTwo
b <- isolate(input$bins)
txt = ""
if((b > 5 & b < 15) | b > 35) {
txt = "That was dangerous."
} else if((b > 5 & b < 20) | b > 30) {
txt = "I warned you about that."
} else if(b >= 20 & b <= 30) {
txt = "You have chosen... wisely."
}
return(txt)
})
}
)
\dontrun{
runApp(app)
}
}
\seealso{
\href{https://getbootstrap.com}{Twitter Bootstrap 3}
Other Buttons:
\code{\link{bsButton}()},
\code{\link{updateButton}()}
}
\concept{Buttons}
shinyBS/man/removePopover.Rd 0000644 0001762 0000144 00000002120 15120510337 015533 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/removePopover.R
\name{removePopover}
\alias{removePopover}
\title{removePopover}
\usage{
removePopover(session, id)
}
\arguments{
\item{session}{The session object passed to function given to shinyServer.}
\item{id}{The id of the element to remove the popover from.}
}
\description{
\code{removePopover} is used within the Server logic of an app to remove an
existing popover from a Shiny input or output.
}
\details{
See \link{Tooltips_and_Popovers} for more information about how to use \code{removePopover} with the
rest of the Tooltips_and_Popovers family.
}
\note{
Run \code{bsExample("Tooltips_and_Popovers")} for an example
of \code{removePopover} functionality.
}
\seealso{
\href{https://getbootstrap.com}{Twitter Bootstrap 3}
Other Tooltips_and_Popovers:
\code{\link{Tooltips_and_Popovers}},
\code{\link{addPopover}()},
\code{\link{addTooltip}()},
\code{\link{bsPopover}()},
\code{\link{bsTooltip}()},
\code{\link{popify}()},
\code{\link{removeTooltip}()},
\code{\link{tipify}()}
}
\concept{Tooltips_and_Popovers}
shinyBS/man/Tooltips_and_Popovers.Rd 0000644 0001762 0000144 00000012022 15120510337 017221 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Tooltips_and_Popovers.R
\name{Tooltips_and_Popovers}
\alias{Tooltips_and_Popovers}
\title{Tooltips and Popovers}
\description{
Tooltips and Popovers allow you to add additional information about controls
or outputs without cluttering up your user interface. You can add a tooltip to
a button that displays on hover and better explains what the button will do, or
you could add a popover to an output providing further analysis of that output.
}
\details{
You can create tooltips and popovers from either the UI script or within the
Server logic. \code{\link{bsTooltip}} and \code{\link{bsPopover}} are used in
the UI, and \code{\link{addTooltip}} and \code{\link{addPopover}} are used in
the Server logic. \code{\link{tipify}} and \code{\link{popify}} can be used
within the UI or from within a \code{\link[shiny:renderUI]{renderUI}} in the Server logic. They
also have the added advantage of not requiring that the UI element have an ID
attribute.
}
\note{
Tooltips and Popovers cannot contain shiny inputs or outputs.
There must be at least one \code{shinyBS} component in the UI of your
app in order for the necessary dependencies to be loaded. Because of this,
\code{\link{addTooltip}} and \code{\link{addPopover}} will not work if they
are the only shinyBS components in your app.
Tooltips and popovers may not work on some of the more complex shiny inputs
or outputs. If you encounter a problem with tooltips or popovers not appearing
please file a issue on the github page so I can fix it.
Run \code{bsExample("Tooltips_and_Popovers")} for an example
of \code{Tooltips_and_Popovers} functionality.
}
\section{Components}{
There are eight functions in the Tooltips and Popovers family:
\describe{
\item{\code{\link{bsTooltip}}}{Used in the UI to add a tooltip to an element
in your UI.}
\item{\code{\link{bsPopover}}}{Used in the UI to add a popover to an element
in your UI.}
\item{\code{\link{tipify}}}{Wrap any UI element in \code{tipify} to add a
tooltip to the wrapped element. Preferred for elemented created with
\code{\link[shiny:renderUI]{renderUI}}.}
\item{\code{\link{popify}}}{Wrap any UI element in \code{popify} to add a
popover to the wrapped element. Preferred for elements created with
\code{\link[shiny:renderUI]{renderUI}}.}
\item{\code{\link{addTooltip}}}{Used in the Server logic to add a tooltip
to an element in your UI.}
\item{\code{\link{addPopover}}}{Used in the Server logic to add a popover
to an element in your UI.}
\item{\code{\link{removeTooltip}}}{Used in the Server logic to remove a
tooltip from an element in your UI.}
\item{\code{\link{removePopover}}}{Used in the Server logic to remove a
popover from an element in your UI.}
}
}
\section{Changes}{
An \code{options} argument has been added to the creation functions to allow
advanced users more control over how the tooltips and popovers appear. See
the \href{https://getbootstrap.com}{Twitter Bootstrap 3 documentation} for more
details.
}
\examples{
library(shiny)
library(shinyBS)
app = shinyApp(
ui =
fluidPage(
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30),
bsTooltip("bins", "The wait times will be broken into this many equally spaced bins",
"right", options = list(container = "body"))
),
mainPanel(
plotOutput("distPlot"),
uiOutput("uiExample")
)
)
),
server =
function(input, output, session) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
output$uiExample <- renderUI({
tags$span(
popify(bsButton("pointlessButton", "Button", style = "primary", size = "large"),
"A Pointless Button",
"This button is pointless. It does not do anything!"),
tipify(bsButton("pB2", "Button", style = "inverse", size = "extra-small"),
"This button is pointless too!")
)
})
addPopover(session, "distPlot", "Data", content = paste0("Waiting time between ", "eruptions and the duration of the eruption for the Old Faithful geyser ", "in Yellowstone National Park, Wyoming, USA.
Azzalini, A. and ", "Bowman, A. W. (1990). A look at some data on the Old Faithful geyser. ", "Applied Statistics 39, 357-365.
"), trigger = 'click') } ) \dontrun{ runApp(app) } } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Tooltips_and_Popovers: \code{\link{addPopover}()}, \code{\link{addTooltip}()}, \code{\link{bsPopover}()}, \code{\link{bsTooltip}()}, \code{\link{popify}()}, \code{\link{removePopover}()}, \code{\link{removeTooltip}()}, \code{\link{tipify}()} } \concept{Tooltips_and_Popovers} shinyBS/man/updateCollapse.Rd 0000644 0001762 0000144 00000002751 15120510337 015642 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/updateCollapse.R \name{updateCollapse} \alias{updateCollapse} \title{updateCollapse} \usage{ updateCollapse(session, id, open = NULL, close = NULL, style = NULL) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \item{id}{The id of the Collapse object you want to change.} \item{open}{A vector of \code{value} (or \code{title} if no \code{value} was provided) values identifying the panels you want to open.} \item{close}{A vector of \code{value} (or \code{title} if no \code{value} was provided) values identifying the panels you want to close.} \item{style}{A named list of Bootstrap styles (\code{primary}, \code{danger}, \code{info}, \code{warning}, \code{success}, or \code{default}). The names should correspond to the \code{value} (or \code{title} if no \code{value} was provided) of the \code{\link{bsCollapsePanel}} you want to change.} } \description{ \code{updateCollapse} is used within the Server logic of your Shiny app to modify a Collapse after load. } \details{ See \link{Collapses} for more information about how to use \code{updateCollapse} with the rest of the Collapses family. } \note{ Run \code{bsExample("Collapses")} for an example of \code{updateCollapse} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Collapses: \code{\link{Collapses}}, \code{\link{bsCollapse}()}, \code{\link{bsCollapsePanel}()} } \concept{Collapses} shinyBS/man/updateButton.Rd 0000644 0001762 0000144 00000003671 15120510337 015355 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/updateButton.R \name{updateButton} \alias{updateButton} \title{updateButton} \usage{ updateButton( session, inputId, label = NULL, icon = NULL, value = NULL, style = NULL, size = NULL, block = NULL, disabled = NULL ) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \item{inputId}{The \code{input} slot that will be used to access the value.} \item{label}{The contents of the button or link--usually a text label, but you could also use any other HTML, like an image.} \item{icon}{An optional \code{\link[shiny:icon]{icon()}} to appear on the button.} \item{value}{\bold{logical} If \code{type = "toggle"}, the initial value of the button.} \item{style}{A Bootstrap style to apply to the button. (\code{default}, \code{primary}, \code{success}, \code{info}, \code{warning}, or \code{danger})} \item{size}{The size of the button (\code{extra-small}, \code{small}, \code{default}, or \code{large})} \item{block}{\bold{logical} Should the button take the full width of the parent element?} \item{disabled}{\bold{logical} Should the button be disabled (un-clickable)?} } \description{ \code{updateButton} is used in your Server logic to update the style or state of a button. } \details{ Because of the way it is coded, \code{updateButton} may work on buttons not created by \code{\link{bsButton}} such as \code{\link[shiny:submitButton]{submitButton}}. See \code{\link{Buttons}} for more information about how to use \code{updateButton} with the rest of the Buttons family. See \link{Buttons} for more information about how to use \code{updateButton} with the rest of the Buttons family. } \note{ Run \code{bsExample("Buttons")} for an example of \code{updateButton} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Buttons: \code{\link{Buttons}}, \code{\link{bsButton}()} } \concept{Buttons} shinyBS/man/Modals.Rd 0000644 0001762 0000144 00000005720 15120510337 014113 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/Modals.R \name{Modals} \alias{Modals} \title{Modals} \description{ Modal windows are similar to popups but are rendered within the original window. They can contain any combination of shiny inputs, shiny outputs, and html. Possible uses include extra controls that you don't want cluttering up the main app display or help pages to explain your apps operation. } \details{ Use \code{\link{bsModal}} in your UI to create a modal window. It works like \code{\link{Collapses}} or \code{\link[shiny:tabPanel]{tabPanel}}, any non-named arguments will be passed as content for the modal. Create a button or link and assign its \code{inputId} as the \code{trigger} in \code{\link{bsModal}}. } \note{ Run \code{bsExample("Modals")} for an example of \code{Modals} functionality. } \section{Components}{ There are only two functions in the Modals family: \describe{ \item{\code{\link{bsModal}}}{Used in the UI to create a modal window.} \item{\code{\link{toggleModal}}}{Used in the Server logic to open or close a modal window programmatically.} } } \section{Changes}{ There is now a \code{toggle} argument in \code{\link{toggleModal}} that allows you to specify whether you want the modal to open or close. The \code{size} argument in \code{\link{bsModal}} allows you to specify the size of the modal window. Either \code{small} or \code{large}. } \examples{ library(shiny) library(shinyBS) app = shinyApp( ui = fluidPage( sidebarLayout( sidebarPanel( sliderInput("bins", "Number of bins:", min = 1, max = 50, value = 30), actionButton("tabBut", "View Table") ), mainPanel( plotOutput("distPlot"), bsModal("modalExample", "Data Table", "tabBut", size = "large", dataTableOutput("distTable")) ) ) ), server = function(input, output, session) { output$distPlot <- renderPlot({ x <- faithful[, 2] bins <- seq(min(x), max(x), length.out = input$bins + 1) # draw the histogram with the specified number of bins hist(x, breaks = bins, col = 'darkgray', border = 'white') }) output$distTable <- renderDataTable({ x <- faithful[, 2] bins <- seq(min(x), max(x), length.out = input$bins + 1) # draw the histogram with the specified number of bins tab <- hist(x, breaks = bins, plot = FALSE) tab$breaks <- sapply(seq(length(tab$breaks) - 1), function(i) { paste0(signif(tab$breaks[i], 3), "-", signif(tab$breaks[i+1], 3)) }) tab <- as.data.frame(do.call(cbind, tab)) colnames(tab) <- c("Bins", "Counts", "Density") return(tab[, 1:3]) }, options = list(pageLength=10)) } ) \dontrun{ runApp(app) } } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Modals: \code{\link{bsModal}()}, \code{\link{toggleModal}()} } \concept{Modals} shinyBS/man/bsModal.Rd 0000644 0001762 0000144 00000002445 15120510337 014256 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsModal.R \name{bsModal} \alias{bsModal} \title{bsModal} \usage{ bsModal( id, title, trigger, ..., size, footer = NULL, close.button = TRUE, width = NULL ) } \arguments{ \item{id}{A unique identifier for the modal window} \item{title}{The title to appear at the top of the modal} \item{trigger}{The id of a button or link that will open the modal.} \item{\dots}{UI elements to include within the modal} \item{size}{\bold{Optional} What size should the modal be? (\code{small} or \code{large})} \item{footer}{A \code{list} of shiny UI elements to be added to the footer of the modal.} \item{close.button}{Should a close button be added to the footer of the modal?} \item{width}{An optional width argument for the modal. Must include units. Only applied if \code{size} is missing.} } \description{ \code{bsModal} is used within the UI to create a modal window. } \details{ See \link{Modals} for more information about how to use \code{bsModal} with the rest of the Modals family. } \note{ Run \code{bsExample("Modals")} for an example of \code{bsModal} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Modals: \code{\link{Modals}}, \code{\link{toggleModal}()} } \concept{Modals} shinyBS/man/bsButton.Rd 0000644 0001762 0000144 00000003331 15120510337 014470 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsButton.R \name{bsButton} \alias{bsButton} \title{bsButton} \usage{ bsButton( inputId, label, icon = NULL, ..., style = "default", size = "default", type = "action", block = FALSE, disabled = FALSE, value = FALSE ) } \arguments{ \item{inputId}{The \code{input} slot that will be used to access the value.} \item{label}{The contents of the button or link--usually a text label, but you could also use any other HTML, like an image.} \item{icon}{An optional \code{\link[shiny:icon]{icon()}} to appear on the button.} \item{...}{Named attributes to be applied to the button or link.} \item{style}{A Bootstrap style to apply to the button. (\code{default}, \code{primary}, \code{success}, \code{info}, \code{warning}, or \code{danger})} \item{size}{The size of the button (\code{extra-small}, \code{small}, \code{default}, or \code{large})} \item{type}{The type of button to create. (\code{action} or \code{toggle})} \item{block}{\bold{logical} Should the button take the full width of the parent element?} \item{disabled}{\bold{logical} Should the button be disabled (un-clickable)?} \item{value}{\bold{logical} If \code{type = "toggle"}, the initial value of the button.} } \description{ \code{bsButton} is used in your UI script to create customizable action and toggle buttons. } \details{ See \link{Buttons} for more information about how to use \code{bsButton} with the rest of the Buttons family. } \note{ Run \code{bsExample("Buttons")} for an example of \code{bsButton} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Buttons: \code{\link{Buttons}}, \code{\link{updateButton}()} } \concept{Buttons} shinyBS/man/updateTypeahead.Rd 0000644 0001762 0000144 00000001322 15116524126 016003 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/updateTypeahead.R \name{updateTypeahead} \alias{updateTypeahead} \title{updateTypeahead} \usage{ updateTypeahead(session, inputId, label = NULL, value = NULL, choices = NULL) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \item{inputId}{Input variable to assign the control's value to} \item{label}{Display label for the control} \item{value}{Initial value} \item{choices}{Array of strings to match against. Can also be JavaScript function. Use htmlwidgets::JS() to indicate JavaScript.} } \description{ \code{updateTypeahead} Update a bsTypeahead buttons. } \seealso{ \code{\link{bsTypeahead}} } shinyBS/man/bsAlert.Rd 0000644 0001762 0000144 00000001554 15120510337 014271 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsAlert.R \name{bsAlert} \alias{bsAlert} \title{bsAlert} \usage{ bsAlert(anchorId, inline = TRUE) } \arguments{ \item{anchorId}{A unique id the identifies the anchor.} \item{inline}{Logical value, determmines the class of the alert. Defaults to TRUE.} } \description{ \code{bsAlert} creates an anchor point in your UI definition. This anchor point is where alerts created in your Server logic will be displayed. } \details{ See \link{Alerts} for more information about how to use \code{bsAlert} with the rest of the Alerts family. } \note{ Run \code{bsExample("Alerts")} for an example of \code{bsAlert} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Alerts: \code{\link{Alerts}}, \code{\link{closeAlert}()}, \code{\link{createAlert}()} } \concept{Alerts} shinyBS/man/closeAlert.Rd 0000644 0001762 0000144 00000001523 15120510337 014766 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/closeAlert.R \name{closeAlert} \alias{closeAlert} \title{closeAlert} \usage{ closeAlert(session, alertId) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \item{alertId}{The id of the alert to be dismissed.} } \description{ \code{closeAlert} is used within your Server logic to close an alert that you created with \code{\link{createAlert}}. } \details{ See \link{Alerts} for more information about how to use \code{closeAlert} with the rest of the Alerts family. } \note{ Run \code{bsExample("Alerts")} for an example of \code{closeAlert} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Alerts: \code{\link{Alerts}}, \code{\link{bsAlert}()}, \code{\link{createAlert}()} } \concept{Alerts} shinyBS/man/bsTooltip.Rd 0000644 0001762 0000144 00000002672 15120510337 014656 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsTooltip.R \name{bsTooltip} \alias{bsTooltip} \title{bsTooltip} \usage{ bsTooltip(id, title, placement = "bottom", trigger = "hover", options = NULL) } \arguments{ \item{id}{The id of the element to attach the tooltip to.} \item{title}{The content of the tooltip.} \item{placement}{Where the tooltip should appear relative to its target (\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}.} \item{trigger}{What action should cause the tooltip to appear? (\code{hover}, \code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}.} \item{options}{A named list of additional options to be set on the tooltip.} } \description{ \code{bsTooltip} is used within the UI of an app to add a tooltip to a Shiny input or output. } \details{ See \link{Tooltips_and_Popovers} for more information about how to use \code{bsTooltip} with the rest of the Tooltips_and_Popovers family. } \note{ Run \code{bsExample("Tooltips_and_Popovers")} for an example of \code{bsTooltip} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Tooltips_and_Popovers: \code{\link{Tooltips_and_Popovers}}, \code{\link{addPopover}()}, \code{\link{addTooltip}()}, \code{\link{bsPopover}()}, \code{\link{popify}()}, \code{\link{removePopover}()}, \code{\link{removeTooltip}()}, \code{\link{tipify}()} } \concept{Tooltips_and_Popovers} shinyBS/man/bsPopover.Rd 0000644 0001762 0000144 00000003001 15120510337 014641 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsPopover.R \name{bsPopover} \alias{bsPopover} \title{bsPopover} \usage{ bsPopover( id, title, content, placement = "bottom", trigger = "hover", options = NULL ) } \arguments{ \item{id}{The id of the element to attach the popover to.} \item{title}{The title of the popover.} \item{content}{The main content of the popover.} \item{placement}{Where the popover should appear relative to its target (\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}.} \item{trigger}{What action should cause the popover to appear? (\code{hover}, \code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}.} \item{options}{A named list of additional options to be set on the popover.} } \description{ \code{bsPopover} is used within the UI of an app to add a popover to a Shiny input or output. } \details{ See \link{Tooltips_and_Popovers} for more information about how to use \code{bsPopover} with the rest of the Tooltips_and_Popovers family. } \note{ Run \code{bsExample("Tooltips_and_Popovers")} for an example of \code{bsPopover} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Tooltips_and_Popovers: \code{\link{Tooltips_and_Popovers}}, \code{\link{addPopover}()}, \code{\link{addTooltip}()}, \code{\link{bsTooltip}()}, \code{\link{popify}()}, \code{\link{removePopover}()}, \code{\link{removeTooltip}()}, \code{\link{tipify}()} } \concept{Tooltips_and_Popovers} shinyBS/man/Alerts.Rd 0000644 0001762 0000144 00000005762 15120510337 014134 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/Alerts.R \name{Alerts} \alias{Alerts} \title{Alerts} \description{ Alerts allow you to communicate information to the user on the fly. Standard Bootstrap styling options give the user a hint at the type of information contained in the Alert. } \details{ To create alerts in your Shiny app you must place \code{bsAlert} in your ui. This serves as an anchor that tells shinyBS where to place the alerts created with \code{createAlert}. Use \code{createAlert} in your server script to add alerts to the anchor you created with \code{bsAlert} in your ui. You can place \code{createAlert} in observers, reactives, or outputs. A common usage may be to have logic that validates a user's inputs. If they are valid produce the requested output, if not use \code{createAlert} to give the user info about what they need to change. } \note{ Run \code{bsExample("Alerts")} for an example of \code{Alerts} functionality. } \section{Components}{ There are three functions in the Alerts family: \describe{ \item{\code{\link{bsAlert}}}{Used in the UI to create an anchor where your Alerts will be displayed.} \item{\code{\link{createAlert}}}{Used in the Server logic to create alerts. This would be used within a reactive context to display error or success messages to the user based on the status of that context.} \item{\code{\link{closeAlert}}}{Used in the Server logic to close an alert that is already open. By default, Alerts are dismissable by the user, but this offers you a way to close them programmatically.} } } \section{Changes}{ \code{style} was called \code{type} in previous versions of shinyBS. \code{anchorId} was called \code{inputId} in previous versions of shinyBS. \code{content} was called \code{message} in previous versions of shinyBS. } \examples{ library(shiny) library(shinyBS) app = shinyApp( ui = fluidPage( sidebarLayout( sidebarPanel(textInput("num1", NULL, value = 100), "divided by", textInput("num2", NULL, value = 20), "equals", textOutput("exampleOutput")), mainPanel( bsAlert("alert") ) ) ), server = function(input, output, session) { output$exampleOutput <- renderText({ num1 <- as.numeric(input$num1) num2 <- as.numeric(input$num2) if(is.na(num1) | is.na(num2)) { createAlert(session, "alert", "exampleAlert", title = "Oops", content = "Both inputs should be numeric.", append = FALSE) } else if(num2 == 0) { createAlert(session, "alert", "exampleAlert", title = "Oops", content = "You cannot divide by 0.", append = FALSE) } else { closeAlert(session, "exampleAlert") return(num1/num2) } }) } ) \dontrun{ runApp(app) } } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Alerts: \code{\link{bsAlert}()}, \code{\link{closeAlert}()}, \code{\link{createAlert}()} } \concept{Alerts} shinyBS/man/addTooltip.Rd 0000644 0001762 0000144 00000003057 15120510337 015000 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/addTooltip.R \name{addTooltip} \alias{addTooltip} \title{addTooltip} \usage{ addTooltip( session, id, title, placement = "bottom", trigger = "hover", options = NULL ) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \item{id}{The id of the element to attach the tooltip to.} \item{title}{The content of the tooltip.} \item{placement}{Where the tooltip should appear relative to its target (\code{top}, \code{bottom}, \code{left}, or \code{right}). Defaults to \code{"bottom"}.} \item{trigger}{What action should cause the tooltip to appear? (\code{hover}, \code{focus}, \code{click}, or \code{manual}). Defaults to \code{"hover"}.} \item{options}{A named list of additional options to be set on the tooltip.} } \description{ \code{addTooltip} is used within the Server logic of an app to add a tooltip to a Shiny input or output. } \details{ See \link{Tooltips_and_Popovers} for more information about how to use \code{addTooltip} with the rest of the Tooltips_and_Popovers family. } \note{ Run \code{bsExample("Tooltips_and_Popovers")} for an example of \code{addTooltip} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Tooltips_and_Popovers: \code{\link{Tooltips_and_Popovers}}, \code{\link{addPopover}()}, \code{\link{bsPopover}()}, \code{\link{bsTooltip}()}, \code{\link{popify}()}, \code{\link{removePopover}()}, \code{\link{removeTooltip}()}, \code{\link{tipify}()} } \concept{Tooltips_and_Popovers} shinyBS/man/bsCollapsePanel.Rd 0000644 0001762 0000144 00000002171 15120510337 015740 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsCollapsePanel.R \name{bsCollapsePanel} \alias{bsCollapsePanel} \title{bsCollapsePanel} \usage{ bsCollapsePanel(title, ..., value = title, style = NULL) } \arguments{ \item{title}{The title to display at the top of the panel.} \item{\dots}{UI elements to include within the panel.} \item{value}{\bold{Optional} The value to return when this panel is open. Defaults to \code{title}.} \item{style}{\bold{Optional} A Bootstrap style to apply to the panel. (\code{primary}, \code{danger}, \code{warning}, \code{info}, or \code{success})} } \description{ \code{bsCollapsePanel} creates individual panels within a \code{\link{bsCollapse}} object. } \details{ See \link{Collapses} for more information about how to use \code{bsCollapsePanel} with the rest of the Collapses family. } \note{ Run \code{bsExample("Collapses")} for an example of \code{bsCollapsePanel} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Collapses: \code{\link{Collapses}}, \code{\link{bsCollapse}()}, \code{\link{updateCollapse}()} } \concept{Collapses} shinyBS/man/removeTooltip.Rd 0000644 0001762 0000144 00000002120 15120510337 015533 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/removeTooltip.R \name{removeTooltip} \alias{removeTooltip} \title{removeTooltip} \usage{ removeTooltip(session, id) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \item{id}{The id of the element to remove the tooltip from.} } \description{ \code{removeTooltip} is used within the Server logic of an app to remove an existing tooltip from a Shiny input or output. } \details{ See \link{Tooltips_and_Popovers} for more information about how to use \code{removeTooltip} with the rest of the Tooltips_and_Popovers family. } \note{ Run \code{bsExample("Tooltips_and_Popovers")} for an example of \code{removeTooltip} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Tooltips_and_Popovers: \code{\link{Tooltips_and_Popovers}}, \code{\link{addPopover}()}, \code{\link{addTooltip}()}, \code{\link{bsPopover}()}, \code{\link{bsTooltip}()}, \code{\link{popify}()}, \code{\link{removePopover}()}, \code{\link{tipify}()} } \concept{Tooltips_and_Popovers} shinyBS/man/bsExample.Rd 0000644 0001762 0000144 00000001700 15116525776 014630 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/bsExample.R \name{bsExample} \alias{bsExample} \title{bsExample} \usage{ bsExample(family, display.mode = "showcase", ...) } \arguments{ \item{family}{A shinyBS family name} \item{display.mode}{The display mode to use when running the example. See \code{\link[shiny:runApp]{runApp}}.} \item{\dots}{Other parameters to pass to \code{\link[shiny:runApp]{runApp}}.} } \description{ A function to view examples of shinyBS functionality. Will run the examples found in the examples sections of shinyBS documentation. Use this instead of \code{example}. } \details{ This function is just a wrapper for \code{\link[shiny:runApp]{runApp}} that runs copies of the examples found in the family documention pages of \code{shinyBS}. By default, \code{display.mode} is set to \code{showcase} so you can see the code while the app is running. } \examples{ \dontrun{ bsExample("Alerts")} } shinyBS/man/createAlert.Rd 0000644 0001762 0000144 00000002647 15120510337 015134 0 ustar ligges users % Generated by roxygen2: do not edit by hand % Please edit documentation in R/createAlert.R \name{createAlert} \alias{createAlert} \title{createAlert} \usage{ createAlert( session, anchorId, alertId = NULL, title = NULL, content = NULL, style = NULL, dismiss = TRUE, append = TRUE ) } \arguments{ \item{session}{The session object passed to function given to shinyServer.} \item{anchorId}{The unique identifier of the anchor where the alert should be displayed.} \item{alertId}{\bold{Optional} A unique identifier for the Alert.} \item{title}{\bold{Optional} A title for the Alert.} \item{content}{The main body of the Alert. HTML tags are allowed.} \item{style}{A bootstrap style to apply. Defaults to \code{info}.} \item{dismiss}{\code{logical} Should the Alert be user dismissable? Defaults to \code{TRUE}.} \item{append}{\code{logical} Should the Alert be appended below existing Alerts? Default to \code{TRUE}.} } \description{ \code{createAlert} is used within the Server logic of your Shiny app to display an alert to the user. } \details{ See \link{Alerts} for more information about how to use \code{createAlert} with the rest of the Alerts family. } \note{ Run \code{bsExample("Alerts")} for an example of \code{createAlert} functionality. } \seealso{ \href{https://getbootstrap.com}{Twitter Bootstrap 3} Other Alerts: \code{\link{Alerts}}, \code{\link{bsAlert}()}, \code{\link{closeAlert}()} } \concept{Alerts} shinyBS/DESCRIPTION 0000644 0001762 0000144 00000002175 15156540112 013344 0 ustar ligges users Package: shinyBS Type: Package Title: Extra Twitter Bootstrap Components for Shiny Version: 0.65.0 Date: 2026-03-18 Authors@R: c( person(given = "Eric", family = "Bailey", email = "ebailey@idem.in.gov", role = c("aut") ), person(given = "Federico", family = "Marini", email = "marinif@uni-mainz.de", role = c("cre", "ctb"), comment = c(ORCID = "0000-0003-3252-7758")), person(given = "Jesse", family = "Koops", email = "Jesse.Koops@cito.nl", role = c("ctb") ) ) Description: Adds easy access to additional Twitter Bootstrap components to Shiny. Imports: shiny (>= 0.13.2), htmltools, stats, jsonlite URL: https://github.com/federicomarini/shinyBS/ BugReports: https://github.com/federicomarini/shinyBS/issues License: GPL-3 RoxygenNote: 7.3.3 Encoding: UTF-8 NeedsCompilation: no Packaged: 2026-03-18 14:15:50 UTC; fede Author: Eric Bailey [aut], Federico Marini [cre, ctb] (ORCID: