Learn R Programming

shinyMobile (version 0.1.0)

f7AutoComplete: Create a Framework7 autocomplete input

Description

Build a Framework7 autocomplete input

Usage

f7AutoComplete(
  inputId,
  label,
  placeholder = NULL,
  value = choices[1],
  choices,
  typeahead = TRUE,
  expandInput = TRUE,
  type = c("popup", "page", "dropdown"),
  dropdownPlaceholderText = NULL,
  multiple = FALSE
)

Arguments

inputId

Autocomplete input id.

label

Autocomplete label.

placeholder

Text to write in the container.

value

Autocomplete initial value, if any.

choices

Autocomplete choices.

typeahead

Enables type ahead, will prefill input value with first item in match.

expandInput

If TRUE then input which is used as item-input in List View will be expanded to full screen wide during dropdown visible.

type

Defines how to open Autocomplete, can be page or popup (for Standalone) or dropdown.

dropdownPlaceholderText

Specify dropdown placeholder text.

multiple

Whether to allow multiple value selection. Only works when type is 'popup' or 'page'.

Examples

Run this code
# NOT RUN {
if(interactive()){
 library(shiny)
 library(shinyMobile)

 shinyApp(
   ui = f7Page(
    title = "My app",
    f7SingleLayout(
     navbar = f7Navbar(title = "f7Picker"),
     f7AutoComplete(
      inputId = "myautocomplete1",
      placeholder = "Some text here!",
      dropdownPlaceholderText = "Try to type Apple",
      label = "Type a fruit name",
      type = "dropdown",
      choices = c('Apple', 'Apricot', 'Avocado', 'Banana', 'Melon',
       'Orange', 'Peach', 'Pear', 'Pineapple')
     ),
     textOutput("autocompleteval1"),
     f7AutoComplete(
      inputId = "myautocomplete2",
      placeholder = "Some text here!",
      type = "popup",
      multiple = TRUE,
      label = "Type a fruit name",
      choices = c('Apple', 'Apricot', 'Avocado', 'Banana', 'Melon',
                  'Orange', 'Peach', 'Pear', 'Pineapple')
     ),
     verbatimTextOutput("autocompleteval2")
    )
   ),
   server = function(input, output) {
    observe({
     print(input$myautocomplete1)
     print(input$myautocomplete2)
    })
    output$autocompleteval1 <- renderText(input$myautocomplete1)
    output$autocompleteval2 <- renderPrint(input$myautocomplete2)
   }
 )
}

# }

Run the code above in your browser using DataLab