
Last chance! 50% off unlimited learning
Sale ends in
f7Picker
generates a picker input.
updateF7Picker
changes the value of a picker input on the client.
f7Picker(
inputId,
label,
placeholder = NULL,
value = choices[1],
choices,
rotateEffect = TRUE,
openIn = "auto",
scrollToInput = FALSE,
closeByOutsideClick = TRUE,
toolbar = TRUE,
toolbarCloseText = "Done",
sheetSwipeToClose = FALSE
)updateF7Picker(
inputId,
value = NULL,
choices = NULL,
rotateEffect = NULL,
openIn = NULL,
scrollToInput = NULL,
closeByOutsideClick = NULL,
toolbar = NULL,
toolbarCloseText = NULL,
sheetSwipeToClose = NULL,
session = shiny::getDefaultReactiveDomain()
)
The id of the input object.
Picker label.
Text to write in the container.
Picker initial value, if any.
New picker choices.
Enables 3D rotate effect. Default to TRUE.
Can be auto, popover (to open picker in popover), sheet (to open in sheet modal). In case of auto will open in sheet modal on small screens and in popover on large screens. Default to auto.
Scroll viewport (page-content) to input when picker opened. Default to FALSE.
If enabled, picker will be closed by clicking outside of picker or related input element. Default to TRUE.
Enables picker toolbar. Default to TRUE.
Text for Done/Close toolbar button.
Enables ability to close Picker sheet with swipe. Default to FALSE.
The Shiny session object, usually the default value will suffice.
David Granjon, dgranjon@ymail.com
# Picker input
if(interactive()){
library(shiny)
library(shinyMobile)
shinyApp(
ui = f7Page(
title = "My app",
f7SingleLayout(
navbar = f7Navbar(title = "f7Picker"),
f7Picker(
inputId = "mypicker",
placeholder = "Some text here!",
label = "Picker Input",
choices = c('a', 'b', 'c')
),
textOutput("pickerval")
)
),
server = function(input, output) {
output$pickerval <- renderText(input$mypicker)
}
)
}
# Update picker input
if (interactive()) {
library(shiny)
library(shinyMobile)
shinyApp(
ui = f7Page(
title = "My app",
f7SingleLayout(
navbar = f7Navbar(title = "Update picker"),
f7Card(
f7Button(inputId = "update", label = "Update picker"),
f7Picker(
inputId = "mypicker",
placeholder = "Some text here!",
label = "Picker Input",
choices = c('a', 'b', 'c')
),
verbatimTextOutput("pickerval"),
br(),
f7Button(inputId = "removeToolbar", label = "Remove picker toolbar", color = "red")
)
)
),
server = function(input, output, session) {
output$pickerval <- renderText(input$mypicker)
observeEvent(input$update, {
updateF7Picker(
inputId = "mypicker",
value = "b",
choices = letters,
openIn = "sheet",
toolbarCloseText = "Prout",
sheetSwipeToClose = TRUE
)
})
observeEvent(input$removeToolbar, {
updateF7Picker(
inputId = "mypicker",
value = "b",
choices = letters,
openIn = "sheet",
toolbar = FALSE
)
})
}
)
}
Run the code above in your browser using DataLab