f7Searchbar | R Documentation |
Searchbar to filter elements in a page.
f7Searchbar(
id,
placeholder = "Search",
expandable = FALSE,
inline = FALSE,
options = NULL
)
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 an f7Appbar. Notice that utilities like f7HideOnSearch and f7NotFound are not compatible with this mode. |
options |
Search bar options. See https://v5.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. |
if (interactive()) {
library(shiny)
library(shinyMobile)
cars <- rownames(mtcars)
shinyApp(
ui = f7Page(
title = "Simple searchbar",
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)
shinyApp(
ui = f7Page(
title = "Expandable searchbar",
f7SingleLayout(
navbar = f7Navbar(
title = "f7Searchbar with trigger",
hairline = FALSE,
shadow = TRUE,
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) {}
)
# Searchbar in \link{f7Appbar}
shinyApp(
ui = f7Page(
title = "Searchbar in appbar",
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) {}
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.