EVOLUTION-MANAGER
Edit File: selectInput.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: Create a select list input control</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 selectInput {shiny}"><tr><td>selectInput {shiny}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Create a select list input control</h2> <h3>Description</h3> <p>Create a select list that can be used to choose a single or multiple items from a list of values. </p> <h3>Usage</h3> <pre> selectInput( inputId, label, choices, selected = NULL, multiple = FALSE, selectize = TRUE, width = NULL, size = NULL ) selectizeInput(inputId, ..., options = NULL, width = NULL) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>inputId</code></td> <td> <p>The <code>input</code> slot that will be used to access the value.</p> </td></tr> <tr valign="top"><td><code>label</code></td> <td> <p>Display label for the control, or <code>NULL</code> for no label.</p> </td></tr> <tr valign="top"><td><code>choices</code></td> <td> <p>List of values to select from. If elements of the list are named, then that name — rather than the value — is displayed to the user. It's also possible to group related inputs by providing a named list whose elements are (either named or unnamed) lists, vectors, or factors. In this case, the outermost names will be used as the group labels (leveraging the <code style="white-space: pre;"><optgroup></code> HTML tag) for the elements in the respective sublist. See the example section for a small demo of this feature.</p> </td></tr> <tr valign="top"><td><code>selected</code></td> <td> <p>The initially selected value (or multiple values if <code>multiple = TRUE</code>). If not specified then defaults to the first value for single-select lists and no values for multiple select lists.</p> </td></tr> <tr valign="top"><td><code>multiple</code></td> <td> <p>Is selection of multiple items allowed?</p> </td></tr> <tr valign="top"><td><code>selectize</code></td> <td> <p>Whether to use <span class="pkg">selectize.js</span> or not.</p> </td></tr> <tr valign="top"><td><code>width</code></td> <td> <p>The width of the input, e.g. <code>'400px'</code>, or <code>'100%'</code>; see <code><a href="reexports.html">validateCssUnit()</a></code>.</p> </td></tr> <tr valign="top"><td><code>size</code></td> <td> <p>Number of items to show in the selection box; a larger number will result in a taller box. Not compatible with <code>selectize=TRUE</code>. Normally, when <code>multiple=FALSE</code>, a select input will be a drop-down list, but when <code>size</code> is set, it will be a box instead.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Arguments passed to <code>selectInput()</code>.</p> </td></tr> <tr valign="top"><td><code>options</code></td> <td> <p>A list of options. See the documentation of <span class="pkg">selectize.js</span> for possible options (character option values inside <code><a href="../../base/html/AsIs.html">base::I()</a></code> will be treated as literal JavaScript code; see <code><a href="renderDataTable.html">renderDataTable()</a></code> for details).</p> </td></tr> </table> <h3>Details</h3> <p>By default, <code>selectInput()</code> and <code>selectizeInput()</code> use the JavaScript library <span class="pkg">selectize.js</span> (<a href="https://github.com/selectize/selectize.js">https://github.com/selectize/selectize.js</a>) instead of the basic select input element. To use the standard HTML select input element, use <code>selectInput()</code> with <code>selectize=FALSE</code>. </p> <p>In selectize mode, if the first element in <code>choices</code> has a value of <code>""</code>, its name will be treated as a placeholder prompt. For example: <code>selectInput("letter", "Letter", c("Choose one" = "", LETTERS))</code> </p> <h3>Value</h3> <p>A select list control that can be added to a UI definition. </p> <h3>Server value</h3> <p>A vector of character strings, usually of length 1, with the value of the selected items. When <code>multiple=TRUE</code> and nothing is selected, this value will be <code>NULL</code>. </p> <h3>Note</h3> <p>The selectize input created from <code>selectizeInput()</code> allows deletion of the selected option even in a single select input, which will return an empty string as its value. This is the default behavior of <span class="pkg">selectize.js</span>. However, the selectize input created from <code>selectInput(..., selectize = TRUE)</code> will ignore the empty string value when it is a single choice input and the empty string is not in the <code>choices</code> argument. This is to keep compatibility with <code>selectInput(..., selectize = FALSE)</code>. </p> <h3>See Also</h3> <p><code><a href="updateSelectInput.html">updateSelectInput()</a></code> <code><a href="varSelectInput.html">varSelectInput()</a></code> </p> <p>Other input elements: <code><a href="actionButton.html">actionButton</a>()</code>, <code><a href="checkboxGroupInput.html">checkboxGroupInput</a>()</code>, <code><a href="checkboxInput.html">checkboxInput</a>()</code>, <code><a href="dateInput.html">dateInput</a>()</code>, <code><a href="dateRangeInput.html">dateRangeInput</a>()</code>, <code><a href="fileInput.html">fileInput</a>()</code>, <code><a href="numericInput.html">numericInput</a>()</code>, <code><a href="passwordInput.html">passwordInput</a>()</code>, <code><a href="radioButtons.html">radioButtons</a>()</code>, <code><a href="sliderInput.html">sliderInput</a>()</code>, <code><a href="submitButton.html">submitButton</a>()</code>, <code><a href="textAreaInput.html">textAreaInput</a>()</code>, <code><a href="textInput.html">textInput</a>()</code>, <code><a href="varSelectInput.html">varSelectInput</a>()</code> </p> <h3>Examples</h3> <pre> ## Only run examples in interactive R sessions if (interactive()) { # basic example shinyApp( ui = fluidPage( selectInput("variable", "Variable:", c("Cylinders" = "cyl", "Transmission" = "am", "Gears" = "gear")), tableOutput("data") ), server = function(input, output) { output$data <- renderTable({ mtcars[, c("mpg", input$variable), drop = FALSE] }, rownames = TRUE) } ) # demoing group support in the `choices` arg shinyApp( ui = fluidPage( selectInput("state", "Choose a state:", list(`East Coast` = list("NY", "NJ", "CT"), `West Coast` = list("WA", "OR", "CA"), `Midwest` = list("MN", "WI", "IA")) ), textOutput("result") ), server = function(input, output) { output$result <- renderText({ paste("You chose", input$state) }) } ) } </pre> <hr /><div style="text-align: center;">[Package <em>shiny</em> version 1.5.0 <a href="00Index.html">Index</a>]</div> </body></html>