Selects and creates a shiny input based the type of object x and
other arguments.
Value
One of the following shiny inputs is returned, based on the
type of object passed to x, and other specified arguments. See
vignette("filter-input-catalog") for the full list of examples.
| Value | x | Arguments |
| shiny::dateInput | Date, POSIXt | default |
| shiny::dateRangeInput | Date, POSIXt | range = TRUE |
| shiny::numericInput | numeric | default |
| shiny::radioButtons | character, factor, list, logical | radio = TRUE |
| shiny::selectInput | character, factor, list, logical | default |
| shiny::selectizeInput | character, factor, list, logical | selectize = TRUE |
| shiny::sliderInput | numeric | slider = TRUE |
| shiny::textAreaInput | character | textbox = TRUE, area = TRUE |
| shiny::textInput | character | textbox = TRUE |
Details
The following arguments passed to ... are supported:
- area
(character). Logical. Controls whether to use shiny::textAreaInput (
TRUE) or shiny::textInput (FALSE, default). Only applies whentextboxisTRUE.- radio
(character, factor, list, logical). Logical. Controls whether to use shiny::radioButtons (
TRUE) or a dropdown input (FALSE, default). For character vectors,radioonly applies iftextboxisFALSE, the default.- range
(Date, POSIXt). Logical. Controls whether to use shiny::dateRangeInput (
TRUE) or shiny::dateInput (FALSE, default).- selectize
(character, factor, list, logical). Logical. Controls whether to use shiny::selectizeInput (
TRUE) or shiny::selectInput (FALSE, default). For character vectors,selectizeonly applies iftextboxisFALSE, the default.- slider
(numeric). Logical. Controls whether to use shiny::sliderInput (
TRUE) or shiny::numericInput (FALSE, default).- textbox
(character). Logical. Controls whether to use a text input (
TRUE) or a dropdown input (FALSE, default).- ns
An optional namespace created by
shiny::NS(). Useful when usingfilterInput()on a data.frame inside a shiny module.
Remaining arguments passed to ... are passed to the args_filter_input()
or the selected input function.
Examples
if (FALSE) { # interactive()
library(shiny)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
# Create a filterInput() inside a shiny app:
filterInput(
x = letters,
inputId = "letter",
label = "Pick a letter:"
)
),
mainPanel(
textOutput("selected_letter")
)
)
)
server <- function(input, output, session) {
output$selected_letter <- renderText({
paste("You selected:", input$letter)
})
}
shinyApp(ui, server)
}