shinyBS/0000755000176000001440000000000012506433046011664 5ustar ripleyusersshinyBS/inst/0000755000176000001440000000000012506237222012637 5ustar ripleyusersshinyBS/inst/examples/0000755000176000001440000000000012506237222014455 5ustar ripleyusersshinyBS/inst/examples/Alerts/0000755000176000001440000000000012506237222015707 5ustar ripleyusersshinyBS/inst/examples/Alerts/ui.R0000644000176000001440000000046512506237222016454 0ustar ripleyuserslibrary(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.R0000644000176000001440000000125312506237222017341 0ustar ripleyuserslibrary(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/0000755000176000001440000000000012506237222016113 5ustar ripleyusersshinyBS/inst/examples/Buttons/ui.R0000644000176000001440000000142012506237222016650 0ustar ripleyuserslibrary(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.R0000644000176000001440000000224312506237222017545 0ustar ripleyuserslibrary(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/Collapses/0000755000176000001440000000000012506237222016402 5ustar ripleyusersshinyBS/inst/examples/Collapses/ui.R0000644000176000001440000000155512506237222017150 0ustar ripleyuserslibrary(shiny) library(shinyBS) 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") ) ) ) ) shinyBS/inst/examples/Collapses/server.R0000644000176000001440000000061712506237222020037 0ustar ripleyuserslibrary(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/TooltipsandPopovers/0000755000176000001440000000000012506237222020513 5ustar ripleyusersshinyBS/inst/examples/TooltipsandPopovers/ui.R0000644000176000001440000000076512506237222021263 0ustar ripleyuserslibrary(shiny) library(shinyBS) 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") ) ) ) shinyBS/inst/examples/TooltipsandPopovers/server.R0000644000176000001440000000225512506237222022150 0ustar ripleyuserslibrary(shiny) library(shinyBS) shinyServer( 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') } ) shinyBS/inst/examples/Modals/0000755000176000001440000000000012506237222015674 5ustar ripleyusersshinyBS/inst/examples/Modals/ui.R0000644000176000001440000000074112506237222016436 0ustar ripleyuserslibrary(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.R0000644000176000001440000000164412506237222017332 0ustar ripleyuserslibrary(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/inst/www/0000755000176000001440000000000012506237222013463 5ustar ripleyusersshinyBS/inst/www/shinyBS.css0000644000176000001440000000000012506237222015542 0ustar ripleyusersshinyBS/inst/www/shinyBS.js0000644000176000001440000002031312506237222015377 0ustar ripleyusersvar 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) }, 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); }, 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("

" + data.title + "

"); } if(data.hasOwnProperty("content")) { $alert.append(data.content); } if(data.append == true) { $alert.appendTo("#" + data.id); } else { $("#" + data.id).html($alert); } } }); Shiny.addCustomMessageHandler("bsAlertClose", function(alertId) { $("#" + alertId).alert('close'); }); // The following function refer to tooltips but are used in the creation of // tooltips and popovers because there structure is so similar. type="popover" // will create a popover. shinyBS.addTooltip = function(id, type, opts) { var $id = shinyBS.getTooltipTarget(id); var dopts = {html: true}; opts = $.extend(opts, dopts); if(type == "tooltip") { $id.tooltip("destroy"); $id.tooltip(opts); } else if(type == "popover") { $id.popover("destroy"); $id.popover(opts); } } shinyBS.removeTooltip = function(id, type) { var $id = shinyBS.getTooltipTarget(id); if(type == "tooltip") { $id.tooltip("destroy"); } else if(type == "popover") { $id.popover("destroy"); } } // Makes adjustments to the tooltip and popover targets for specialized // shiny inputs/outputs shinyBS.getTooltipTarget = function(id) { var $id = $("#" + id); if($id.hasClass("js-range-slider")) { $id = $id.parent(); } else if($id.hasClass("selectized")) { $id = $id.siblings("div.selectize-control") } return $id; } Shiny.addCustomMessageHandler("updateTooltipOrPopover", function(data) { if(data.action == "add") { shinyBS.addTooltip(data.id, data.type, data.options); } else if(data.action == "remove") { shinyBS.removeTooltip(data.id, data.type) } }) Shiny.addCustomMessageHandler("bsButtonUpdate", function(data) { var btn = $("button#" + data.id); var ico = btn.find("i"); if(ico.length > 0) { ico = ico[0].outerHTML; } else { ico = ""; }; if(data.hasOwnProperty("label")) { btn.html(ico + data.label); }; if(data.hasOwnProperty("icon")) { var ch = btn.children(); if(ch.length == 0) { btn.prepend(data.icon); } else { btn.find("i").replaceWith(data.icon); }; }; if(data.hasOwnProperty("value")) { if(btn.hasClass("sbs-toggle-button")) { if(data.value != btn.hasClass("active")) { btn.trigger("click"); }; }; }; if(data.hasOwnProperty("style")) { btn .removeClass("btn-default btn-primary btn-success btn-info btn-warning btn-danger btn-link") .addClass("btn-" + data.style); }; if(data.hasOwnProperty("size")) { btn.removeClass("btn-lg btn-sm btn-xs") if(data.size != "default") { btn.addClass(data.size); }; }; if(data.hasOwnProperty("block")) { btn.toggleClass("btn-block", data.block); }; if(data.hasOwnProperty("disabled")) { if(data.disabled) { btn.attr("disabled", "disabled") } else { btn.attr("disabled", false) }; }; })shinyBS/inst/tests/0000755000176000001440000000000012506237222014001 5ustar ripleyusersshinyBS/inst/tests/tipify_test.R0000644000176000001440000000212412506237222016466 0ustar ripleyuserslibrary(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/tests/tipify_test2.R0000644000176000001440000000340512506237222016553 0ustar ripleyuserslibrary(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") ), 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/NAMESPACE0000644000176000001440000000066412506237222013107 0ustar ripleyusers# Generated by roxygen2 (4.1.0): 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(closeAlert) export(createAlert) export(popify) export(removePopover) export(removeTooltip) export(tipify) export(toggleModal) export(updateButton) export(updateCollapse) shinyBS/R/0000755000176000001440000000000012506237222012063 5ustar ripleyusersshinyBS/R/Modals.R0000644000176000001440000000573512506237222013437 0ustar ripleyusers#'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{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/popify.R0000644000176000001440000000251212506237222013514 0ustar ripleyusers#'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{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.R0000644000176000001440000000314012506237222015253 0ustar ripleyusers#'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/updateButton.R0000644000176000001440000000247712506237222014676 0ustar ripleyusers#'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{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/bsTooltip.R0000644000176000001440000000177012506237222014172 0ustar ripleyusers#'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/Alerts.R0000644000176000001440000000570712506237222013451 0ustar ripleyusers#'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 NULLshinyBS/R/Collapses.R0000644000176000001440000000543212506237222014137 0ustar ripleyusers#'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{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{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/createAlert.R0000644000176000001440000000246112506237222014444 0ustar ripleyusers#'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/addTooltip.R0000644000176000001440000000215312506237222014312 0ustar ripleyusers#'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/Tooltips_and_Popovers.R0000644000176000001440000001425312506237222016547 0ustar ripleyusers#'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{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{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{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{http://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)) { 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 } return(options) }shinyBS/R/bsAlert.R0000644000176000001440000000101212506237222013574 0ustar ripleyusers#'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. #' #'@templateVar item_name bsAlert #'@templateVar family_name Alerts #'@template item_details #'@template footer #'@export bsAlert <- function(anchorId) { bsTag <- shiny::tags$div(class = "sbs-alert", id = anchorId, " ") htmltools::attachDependencies(bsTag, shinyBSDep) } shinyBS/R/closeAlert.R0000644000176000001440000000073512506237222014310 0ustar ripleyusers#'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/bsModal.R0000644000176000001440000000354312506237222013574 0ustar ripleyusers#'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}) #'@templateVar item_name bsModal #'@templateVar family_name Modals #'@template item_details #'@template footer #'@export bsModal <- function(id, title, trigger, ..., size) { if(!missing(size)) { if(size == "large") { size = "modal-lg" } else if(size == "small") { size = "modal-sm" } size <- paste("modal-dialog", size) } else { size <- "modal-dialog" } bsTag <- shiny::tags$div(class = "modal sbs-modal fade", id = id, tabindex = "-1", "data-sbs-trigger" = trigger, 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", shiny::tags$button(type = "button", class = "btn btn-default", "data-dismiss" = "modal", "Close") ) ) ) ) htmltools::attachDependencies(bsTag, shinyBSDep) } shinyBS/R/tipify.R0000644000176000001440000000240612506237222013514 0ustar ripleyusers#'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{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/bsPopover.R0000644000176000001440000000207312506237222014167 0ustar ripleyusers#'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/updateCollapse.R0000644000176000001440000000227712506237222015163 0ustar ripleyusers#'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/Buttons.R0000644000176000001440000000777212506237222013661 0ustar ripleyusers#'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{actionButton}} in shiny. #'If \code{type = "toggle"} the button will behave like a \code{\link{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 NULLshinyBS/R/removePopover.R0000644000176000001440000000114112506237222015053 0ustar ripleyusers#'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/toggleModal.R0000644000176000001440000000114512506237222014445 0ustar ripleyusers#'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/R/bsButton.R0000644000176000001440000000360712506237222014014 0ustar ripleyusers#'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/bsCollapse.R0000644000176000001440000000311312506237222014273 0ustar ripleyusers#'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 #'@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/misc.R0000644000176000001440000000243012506237222013140 0ustar ripleyusers.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") # Copy of dropNulls function for shiny to avoid using shiny:::dropNulls dropNulls <- function(x) { x[!vapply(x, is.null, FUN.VALUE = logical(1))] } # Takes a tag and removes any classes in the remove argument removeClass <- function(tag, remove) { if(length(remove) == 1) remove <- strsplit(remove, " ", fixed = TRUE)[[1]] class <- strsplit(tag$attribs$class, " ", fixed = TRUE)[[1]] class <- class[!(class %in% remove)] tag$attribs$class <- paste(class, collapse = " ") return(tag) } addClass <- function(tag, add) { tag$attribs$class <- paste(tag$attribs$class, add) return(tag) } 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/removeTooltip.R0000644000176000001440000000114112506237222015053 0ustar ripleyusers#'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/addPopover.R0000644000176000001440000000225212506237222014312 0ustar ripleyusers#'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/bsExample.R0000644000176000001440000000251712506237222014133 0ustar ripleyusers#'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{runApp}}. #'@param \dots Other parameters to pass to \code{\link{runApp}}. #' #'@details #'This function is just a wrapper for \code{\link{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/MD50000644000176000001440000000655512506433046012207 0ustar ripleyusers15ea70444680fb5d0108a083d24fcac1 *DESCRIPTION 1dca4930370f75217c11eabb7d48af79 *NAMESPACE dc82b1393f8723e9449cfa2adf4d1c39 *R/Alerts.R e9c65e20d49fff1a65f656965a185d44 *R/Buttons.R 878451801f7d1c3bb9bd80a84b841966 *R/Collapses.R 1ba2160a431803d37097738cde34d59f *R/Modals.R 34c2ec9fe8058caa75fba186b0c5cec8 *R/Tooltips_and_Popovers.R f08c6f48f1bae3fc4fd2eba330fb9839 *R/addPopover.R ea338ba0d9241eb23ec3c0e0398a9010 *R/addTooltip.R eb96ad8e104f75521ec4238f963780ec *R/bsAlert.R 5d9261c1cc8dd7c02d33ba12bb75090d *R/bsButton.R 0aae63a5bc20629f979e9d43f84eec1b *R/bsCollapse.R 07fcf84989b5967a834656e6d9c04233 *R/bsCollapsePanel.R 4e6575e7a9413135f586a90e0123df1d *R/bsExample.R b33bbaf0328551badb418ed642e7fe36 *R/bsModal.R 399cabbb385957d4c84080c639ab087f *R/bsPopover.R 00eeb0e6763106a5cc716ad0622c91cd *R/bsTooltip.R 351d02eeb4cb2f6d3b1f2f3c34c17d5e *R/closeAlert.R 78da980a1eac95d08179f1967b691c7e *R/createAlert.R 6e5bc175fa69a2c95a5df265156bd913 *R/misc.R 0e3e545904cc4f60fc0530be8b9ef403 *R/popify.R 8b7170e64e50034dce862944a97e5183 *R/removePopover.R 8b337c15dae05e9ed0f7990d4fce1f3a *R/removeTooltip.R 7ddc875dd0ee298648a13826aed08469 *R/tipify.R 8e88e3272554dd325c894caa41e4c7b5 *R/toggleModal.R 5617918ae0fdc1b77218be949c491512 *R/updateButton.R 4c2a76360b739a5a3c172d13b22afd54 *R/updateCollapse.R d9f2ca8a61724c5e9eb0d103e0ca7b28 *inst/examples/Alerts/server.R d36e74357f0cdc5bd04c0b8afee50c4c *inst/examples/Alerts/ui.R f10236e851d0dd7b3668cb3900280cec *inst/examples/Buttons/server.R 67566abeceb4b4f9c39b674570a6601d *inst/examples/Buttons/ui.R 851ff13067c51f2b158bde712e40508e *inst/examples/Collapses/server.R 045fcb9577620f4caed314948b1356c8 *inst/examples/Collapses/ui.R 96037cd7df97d979aef7f48950e27ea6 *inst/examples/Modals/server.R 93e9774be6f4c887507cc0f1acf6bbb8 *inst/examples/Modals/ui.R 7f5831c166672c11d785c4e8f9d1713e *inst/examples/TooltipsandPopovers/server.R 1a364656bb71c9c213d15418e04e1557 *inst/examples/TooltipsandPopovers/ui.R 2fd7d2a3902ad5a80cff43a9d9f2263b *inst/tests/tipify_test.R 8469195abc3b70603a5e7138399e93f3 *inst/tests/tipify_test2.R d41d8cd98f00b204e9800998ecf8427e *inst/www/shinyBS.css 5f10387e282adadbeb726b3d03066e0a *inst/www/shinyBS.js f9a9226b73b6e9be4fc7b380310294df *man/Alerts.Rd 8687b27e6debc28f72c3582104e95248 *man/Buttons.Rd e20db9f532ba5b01e3331cb713cb520a *man/Collapses.Rd d7208759df5fe79583f69d73612c27ac *man/Modals.Rd 311bc0f4b6e00f4ecb9fa8cba048fc4b *man/Tooltips_and_Popovers.Rd 25fc6ee4eaa275a244e14504c38cf84f *man/addPopover.Rd 3d9f0fe1da816cb6174ebbaf20717dab *man/addTooltip.Rd 2852163f9e6416bfd1ad1874dd114d0b *man/bsAlert.Rd 3a8a81eb6646c02b360c7af3dcdeac9f *man/bsButton.Rd 1303bcdfd21e1e69e212039a1e7b4826 *man/bsCollapse.Rd 8baf9b19eff59152d1d234ef3ea0a70f *man/bsCollapsePanel.Rd 15b685a2947b89ed136430ba404f3a11 *man/bsExample.Rd e0cf52feefb85528d66b7a567dcfd2f6 *man/bsModal.Rd d5a6930c361ee71a6c42e4a96d9fece0 *man/bsPopover.Rd f4e23260719f4b2839bc6438d1bfc359 *man/bsTooltip.Rd 78f757f3b15661469b1dc4dc5173f760 *man/closeAlert.Rd d41672e5804b274c18c41f6664806d52 *man/createAlert.Rd 2bd8761f19585bf4a6e8fed0b40b9c21 *man/popify.Rd e10f2d50dde0c892f31b547dcb637753 *man/removePopover.Rd decc485f82d63482260b955bfb7a2418 *man/removeTooltip.Rd 909903acd5072191fc5c5771b655cd1a *man/tipify.Rd afcade05141146854326cccaf3c8dbfc *man/toggleModal.Rd 3fc0a1cd5c78ee93d65f25dc03249f5b *man/updateButton.Rd 513ff6a786bac6dd25926c93c18eb351 *man/updateCollapse.Rd shinyBS/DESCRIPTION0000644000176000001440000000077612506433046013404 0ustar ripleyusersPackage: shinyBS Type: Package Title: Twitter Bootstrap Components for Shiny Version: 0.61 Date: 2015-03-30 Author: Eric Bailey Maintainer: Eric Bailey Description: Adds additional Twitter Bootstrap components to Shiny. Imports: shiny (>= 0.11), htmltools URL: https://ebailey78.github.io/shinyBS BugReports: https://github.com/ebailey78/shinyBS/issues License: GPL-3 Packaged: 2015-03-30 12:16:24 UTC; ebailey NeedsCompilation: no Repository: CRAN Date/Publication: 2015-03-31 07:52:38 shinyBS/man/0000755000176000001440000000000012506237222012435 5ustar ripleyusersshinyBS/man/toggleModal.Rd0000644000176000001440000000164512506237222015170 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{http://getbootstrap.com}{Twitter Bootstrap 3} Other Modals: \code{\link{Modals}}; \code{\link{bsModal}} } shinyBS/man/removeTooltip.Rd0000644000176000001440000000212412506237222015573 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{http://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}} } shinyBS/man/popify.Rd0000644000176000001440000000306612506237222014237 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{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{http://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}} } shinyBS/man/Tooltips_and_Popovers.Rd0000644000176000001440000001203412506237222017260 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{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{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{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{http://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{http://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}} } shinyBS/man/closeAlert.Rd0000644000176000001440000000154612506237222015027 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{http://getbootstrap.com}{Twitter Bootstrap 3} Other Alerts: \code{\link{Alerts}}; \code{\link{bsAlert}}; \code{\link{createAlert}} } shinyBS/man/bsModal.Rd0000644000176000001440000000173312506237222014311 0ustar ripleyusers% Generated by roxygen2 (4.1.0): do not edit by hand % Please edit documentation in R/bsModal.R \name{bsModal} \alias{bsModal} \title{bsModal} \usage{ bsModal(id, title, trigger, ..., size) } \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{size}{\bold{Optional} What size should the modal be? (\code{small} or \code{large})} \item{\dots}{UI elements to include within the modal} } \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{http://getbootstrap.com}{Twitter Bootstrap 3} Other Modals: \code{\link{Modals}}; \code{\link{toggleModal}} } shinyBS/man/createAlert.Rd0000644000176000001440000000267112506237222015165 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{http://getbootstrap.com}{Twitter Bootstrap 3} Other Alerts: \code{\link{Alerts}}; \code{\link{bsAlert}}; \code{\link{closeAlert}} } shinyBS/man/Collapses.Rd0000644000176000001440000000567412506237222014665 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{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{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{http://getbootstrap.com}{Twitter Bootstrap 3} Other Collapses: \code{\link{bsCollapsePanel}}; \code{\link{bsCollapse}}; \code{\link{updateCollapse}} } shinyBS/man/updateCollapse.Rd0000644000176000001440000000300212506237222015664 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{http://getbootstrap.com}{Twitter Bootstrap 3} Other Collapses: \code{\link{Collapses}}; \code{\link{bsCollapsePanel}}; \code{\link{bsCollapse}} } shinyBS/man/updateButton.Rd0000644000176000001440000000347612506237222015414 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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}{Specifies the 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{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{submitButton}}. See \code{\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{http://getbootstrap.com}{Twitter Bootstrap 3} Other Buttons: \code{\link{Buttons}}; \code{\link{bsButton}} } shinyBS/man/bsPopover.Rd0000644000176000001440000000300312506237222014677 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{http://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}} } shinyBS/man/bsCollapsePanel.Rd0000644000176000001440000000221512506237222015773 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{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})} \item{\dots}{UI elements to include within the panel.} } \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{http://getbootstrap.com}{Twitter Bootstrap 3} Other Collapses: \code{\link{Collapses}}; \code{\link{bsCollapse}}; \code{\link{updateCollapse}} } shinyBS/man/bsExample.Rd0000644000176000001440000000167512506237222014655 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{runApp}}.} \item{\dots}{Other parameters to pass to \code{\link{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{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/bsTooltip.Rd0000644000176000001440000000271012506237222014703 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{http://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}} } shinyBS/man/Buttons.Rd0000644000176000001440000000771512506237222014374 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{actionButton}} in shiny. If \code{type = "toggle"} the button will behave like a \code{\link{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{http://getbootstrap.com}{Twitter Bootstrap 3} Other Buttons: \code{\link{bsButton}}; \code{\link{updateButton}} } shinyBS/man/Modals.Rd0000644000176000001440000000575312506237222014155 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{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{http://getbootstrap.com}{Twitter Bootstrap 3} Other Modals: \code{\link{bsModal}}; \code{\link{toggleModal}} } shinyBS/man/addTooltip.Rd0000644000176000001440000000306112506237222015027 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{http://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}} } shinyBS/man/Alerts.Rd0000644000176000001440000000605112506237222014160 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{http://getbootstrap.com}{Twitter Bootstrap 3} Other Alerts: \code{\link{bsAlert}}; \code{\link{closeAlert}}; \code{\link{createAlert}} } shinyBS/man/bsButton.Rd0000644000176000001440000000334612506237222014532 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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}{Specifies the 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{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{http://getbootstrap.com}{Twitter Bootstrap 3} Other Buttons: \code{\link{Buttons}}; \code{\link{updateButton}} } shinyBS/man/removePopover.Rd0000644000176000001440000000212412506237222015573 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{http://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}} } shinyBS/man/bsCollapse.Rd0000644000176000001440000000240012506237222015007 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{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.} \item{\dots}{\code{\link{bsCollapsePanel}} elements to include in the Collapse.} } \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{http://getbootstrap.com}{Twitter Bootstrap 3} Other Collapses: \code{\link{Collapses}}; \code{\link{bsCollapsePanel}}; \code{\link{updateCollapse}} } shinyBS/man/bsAlert.Rd0000644000176000001440000000143212506237222014320 0ustar ripleyusers% Generated by roxygen2 (4.1.0): do not edit by hand % Please edit documentation in R/bsAlert.R \name{bsAlert} \alias{bsAlert} \title{bsAlert} \usage{ bsAlert(anchorId) } \arguments{ \item{anchorId}{A unique id the identifies the anchor.} } \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{http://getbootstrap.com}{Twitter Bootstrap 3} Other Alerts: \code{\link{Alerts}}; \code{\link{closeAlert}}; \code{\link{createAlert}} } shinyBS/man/addPopover.Rd0000644000176000001440000000315012506237222015026 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{http://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}} } shinyBS/man/tipify.Rd0000644000176000001440000000277012506237222014236 0ustar ripleyusers% Generated by roxygen2 (4.1.0): 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{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{http://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}} }