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 |
| dateInput | Date, POSIXt | default |
| dateRangeInput | Date, POSIXt | range = TRUE |
| numericInput | numeric | default |
| radioButtons | character, factor, list, logical | radio = TRUE |
| selectInput | character, factor, list, logical | default |
| selectizeInput | character, factor, list, logical | selectize = TRUE |
| sliderInput | numeric | slider = TRUE |
| textAreaInput | character | textbox = TRUE, area = TRUE |
| textInput | character | textbox = TRUE |
Details
The following arguments passed to ... are supported:
- area
(character). Logical. Controls whether to use textAreaInput (
TRUE) or textInput (FALSE, default). Only applies whentextboxisTRUE.- radio
(character, factor, list, logical). Logical. Controls whether to use radioButtons (
TRUE) or a dropdown input (FALSE, default). For character vectors,radioonly applies iftextboxisFALSE, the default.- range
(Date, POSIXt). Logical. Controls whether to use dateRangeInput (
TRUE) or dateInput (FALSE, default).- selectize
(character, factor, list, logical). Logical. Controls whether to use selectizeInput (
TRUE) or selectInput (FALSE, default). For character vectors,selectizeonly applies iftextboxisFALSE, the default.- slider
(numeric). Logical. Controls whether to use sliderInput (
TRUE) or 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
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)
}