Learn R Programming

shinyMobile (version 2.0.0)

f7Select: Framework7 select input

Description

f7Select creates a select input.

updateF7Select changes the value of a select input on the client

Usage

f7Select(
  inputId,
  label,
  choices,
  selected = NULL,
  width = NULL,
  style = list(media = NULL, description = NULL, outline = FALSE)
)

updateF7Select( inputId, selected = NULL, session = shiny::getDefaultReactiveDomain() )

Arguments

inputId

Text input id.

label

Text input label.

choices

Select input choices.

selected

Select input default selected value.

width

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

style

Input style. A list with media (image or icon), description (text), floating, outline and clearable (booleans).

session

The Shiny session object, usually the default value will suffice.

Examples

Run this code
library(shiny)
library(shinyMobile)

app <- shinyApp(
  ui = f7Page(
    title = "f7Select",
    f7SingleLayout(
      navbar = f7Navbar(title = "updateF7Select"),
      f7Card(
        f7Button(inputId = "update", label = "Update select"),
        br(),
        f7List(
          f7Select(
            inputId = "select",
            label = "Choose a variable:",
            choices = colnames(mtcars)[-1],
            selected = "hp",
            style = list(
              description = "A basic select input",
              media = f7Icon("car_fill"),
              outline = TRUE
            )
          )
        ),
        verbatimTextOutput("test")
      )
    )
  ),
  server = function(input, output, session) {
    output$test <- renderPrint(input$select)

    observeEvent(input$update, {
      updateF7Select(
        inputId = "select",
        selected = "gear"
      )
    })
  }
)

if (interactive() || identical(Sys.getenv("TESTTHAT"), "true")) app

Run the code above in your browser using DataLab