Learn R Programming

shinyMobile (version 0.7.0)

f7Searchbar: Create a Framework 7 searchbar

Description

Create a Framework 7 searchbar

Usage

f7Searchbar(
  id = NULL,
  placeholder = "Search",
  expandable = FALSE,
  inline = FALSE
)

Arguments

id

Necessary when using f7SearchbarTrigger. NULL otherwise.

placeholder

Searchbar placeholder.

expandable

Whether to enable the searchbar with a target link, in the navbar. See f7SearchbarTrigger.

inline

Useful to add a f7Searchbar in a f7Appbar. Notice that utilities like f7HideOnSearch and f7NotFound are not compatible with this mode.

Examples

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

cars <- rownames(mtcars)

shiny::shinyApp(
  ui = f7Page(
    title = "My app",
    f7SingleLayout(
      navbar = f7Navbar(
        title = "f7Searchbar",
        hairline = FALSE,
        shadow = TRUE,
        subNavbar = f7SubNavbar(
          f7Searchbar(id = "search1")
        )
      ),
      f7Block(
        "This block will be hidden on search.
        Lorem ipsum dolor sit amet, consectetur adipisicing elit."
      ) %>% f7HideOnSearch(),
      f7List(
        lapply(seq_along(cars), function(i) {
          f7ListItem(cars[i])
        })
      ) %>% f7Found(),

      f7Block(
        p("Nothing found")
      ) %>% f7NotFound()

    )
  ),
  server = function(input, output) {}
 )

 # Expandable searchbar with trigger
 cities <- names(precip)

 shiny::shinyApp(
   ui = f7Page(
     title = "My app",
     f7SingleLayout(
       navbar = f7Navbar(
         title = "f7Searchbar with trigger",
         hairline = FALSE,
         shadow = TRUE,
         f7SearchbarTrigger(targetId = "search1"),
         subNavbar = f7SubNavbar(
           f7Searchbar(id = "search1", expandable = TRUE)
         )
       ),
       f7Block(
         "This block will be hidden on search.
         Lorem ipsum dolor sit amet, consectetur adipisicing elit."
       ) %>% f7HideOnSearch(),
       f7List(
         lapply(seq_along(cities), function(i) {
           f7ListItem(cities[i])
         })
       ) %>% f7Found(),

       f7Block(
         p("Nothing found")
       ) %>% f7NotFound()

     )
   ),
   server = function(input, output) {}
 )

 # Searchbar in \link{f7Appbar}
 shiny::shinyApp(
  ui = f7Page(
    title = "My app",
    f7Appbar(
      f7Searchbar(id = "search1", inline = TRUE)
    ),
    f7SingleLayout(
      navbar = f7Navbar(
        title = "f7Searchbar in f7Appbar",
        hairline = FALSE,
        shadow = TRUE
      ),
      f7List(
        lapply(seq_along(cities), function(i) {
          f7ListItem(cities[i])
        })
      ) %>% f7Found()
    )
  ),
  server = function(input, output) {}
 )
}
# }

Run the code above in your browser using DataLab