Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

searchInput

Search Input


Description

A text input only triggered when Enter key is pressed or search button clicked

Usage

searchInput(
  inputId,
  label = NULL,
  value = "",
  placeholder = NULL,
  btnSearch = NULL,
  btnReset = NULL,
  resetValue = "",
  width = NULL
)

Arguments

inputId

The input slot that will be used to access the value.

label

Display label for the control, or NULL for no label.

value

Initial value.

placeholder

A character string giving the user a hint as to what can be entered into the control.

btnSearch

An icon for the button which validate the search.

btnReset

An icon for the button which reset the search.

resetValue

Value used when reset button is clicked, default to "", if NULL value is not reset.

width

The width of the input, e.g. '400px', or '100%'.

Note

The two buttons ('search' and 'reset') act like actionButton, you can retrieve their value server-side with input$<INPUTID>_search and input$<INPUTID>_reset.

See Also

updateSearchInput to update value server-side.

Examples

if (interactive()) {
  ui <- fluidPage(
    tags$h1("Search Input"),
    br(),
    searchInput(
      inputId = "search", label = "Enter your text",
      placeholder = "A placeholder",
      btnSearch = icon("search"),
      btnReset = icon("remove"),
      width = "450px"
    ),
    br(),
    verbatimTextOutput(outputId = "res")
  )

  server <- function(input, output, session) {
    output$res <- renderPrint({
      input$search
    })
  }

  shinyApp(ui = ui, server = server)
}

shinyWidgets

Custom Inputs Widgets for Shiny

v0.6.0
GPL-3
Authors
Victor Perrier [aut, cre, cph], Fanny Meyer [aut], David Granjon [aut], Ian Fellows [ctb] (Methods for mutating vertical tabs & updateMultiInput), Wil Davis [ctb] (numericRangeInput function), Spencer Matthews [ctb] (autoNumeric methods), JavaScript and CSS libraries authors [ctb, cph] (All authors are listed in LICENSE.md)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.