Skip to contents

Searchbar to filter elements in a page.

f7SearchbarTrigger: Element that triggers the searchbar.

f7HideOnSearch: elements with such class on page will be hidden during search

f7HideOnEnable: elements with such class on page will be hidden when searchbar is enabled

f7NotFound: elements with such class are hidden by default and become visible when there is not any search results

f7Found: elements with such class are visible by default and become hidden when there is not any search results.

f7SearchIgnore: searchbar will not consider this elements in search results.

Usage

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

f7SearchbarTrigger(targetId)

f7HideOnSearch(tag)

f7HideOnEnable(tag)

f7NotFound(tag)

f7Found(tag)

f7SearchIgnore(tag)

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 an f7Searchbar in a navbar. Notice that utilities like f7HideOnSearch and f7NotFound are not compatible with this mode.

options

Search bar options. See https://framework7.io/docs/searchbar.html#searchbar-parameters. If no options are provided, the searchbar will search in list elements by item title. This may be changed by updating the default searchContainer and searchIn.

targetId

Id of the f7Searchbar.

tag

tag to ignore.

Examples

library(shiny)
library(shinyMobile)

cities <- names(precip)

app <- shinyApp(
  ui = f7Page(
    title = "Expandable searchbar",
    f7SingleLayout(
      navbar = f7Navbar(
        title = "f7Searchbar with trigger",
        subNavbar = f7SubNavbar(
          f7Searchbar(id = "search1", expandable = TRUE)
        )
      ),
      f7Block(
        f7SearchbarTrigger(targetId = "search1")
      ) %>% f7HideOnSearch(),
      f7List(
        lapply(seq_along(cities), function(i) {
          f7ListItem(cities[i])
        })
      ) %>% f7Found(),
      f7Block(
        p("Nothing found")
      ) %>% f7NotFound()
    )
  ),
  server = function(input, output) {}
)

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