EVOLUTION-MANAGER
Edit File: Buttons.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Buttons</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for Buttons {shinyBS}"><tr><td>Buttons {shinyBS}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Buttons</h2> <h3>Description</h3> <p>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. </p> <h3>Details</h3> <p>Create a button in the UI with <code><a href="bsButton.html">bsButton</a></code>. If <code>type = "action"</code> the button will behave like the standard <code><a href="../../shiny/html/actionButton.html">actionButton</a></code> in shiny. If <code>type = "toggle"</code> the button will behave like a <code><a href="../../shiny/html/checkboxInput.html">checkboxInput</a></code> with an on and off state. It will return <code>TRUE</code> or <code>FALSE</code> to the Server depending on its state. </p> <p>You can update the style and state of a <code><a href="bsButton.html">bsButton</a></code> from the Server logic with <code><a href="updateButton.html">updateButton</a></code>. For example, a button could be set to <code>disabled = TRUE</code> until the user has made some other selections, then once those selections have been made, an observer on the Server could use <code><a href="updateButton.html">updateButton</a></code> to enable the button allowing the user to proceed. Alternatively, you could set the button to <code>style = "success"</code> to let them know that the button is ready to be clicked. </p> <h3>Components</h3> <p>There are two functions in the Buttons family: </p> <dl> <dt><code><a href="bsButton.html">bsButton</a></code></dt><dd><p>Used in the UI to create a button. Buttons can be of the type <code>action</code> or <code>toggle</code>.</p> </dd> <dt><code><a href="updateButton.html">updateButton</a></code></dt><dd><p>Used in the Server logic to modify the state of a button created with <code><a href="bsButton.html">bsButton</a></code></p> </dd> </dl> <h3>Changes</h3> <p><code>bsActionButton</code> and <code>bsToggleButton</code> were replaced with just <code><a href="bsButton.html">bsButton</a></code> with a <code>type</code> argument. </p> <p><code>icon</code> was added to allow placing an icon in the button. </p> <h3>Note</h3> <p>Run <code>bsExample("Buttons")</code> for an example of <code>Buttons</code> functionality. </p> <h3>See Also</h3> <p><a href="http://getbootstrap.com">Twitter Bootstrap 3</a> </p> <p>Other Buttons: <code><a href="bsButton.html">bsButton</a></code>; <code><a href="updateButton.html">updateButton</a></code> </p> <h3>Examples</h3> <pre> 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) }) } ) ## Not run: runApp(app) ## End(Not run) </pre> <hr /><div style="text-align: center;">[Package <em>shinyBS</em> version 0.61.1 <a href="00Index.html">Index</a>]</div> </body></html>