material_dropdown: Create a shinymaterial dropdown

Description Usage Arguments See Also Examples

View source: R/shiny-material-dropdown.R

Description

Build a shinymaterial dropdown.

Usage

1
2
3
4
5
6
7
8
material_dropdown(
  input_id,
  label,
  choices = NULL,
  selected = NULL,
  multiple = NULL,
  color = NULL
)

Arguments

input_id

String. The input identifier used to access the value.

label

String. The dropdown label.

choices

Named vector. The option names and underyling values.

selected

String. The initially selected underyling value.

multiple

Boolean. Can multiple items be selected?

color

String. The color of the dropdown choices. Leave empty for the default color. Visit https://materializecss.com/color.html for a list of available colors. This input requires using color hex codes, rather than the word form. E.g., "#ef5350", rather than "red lighten-1".

See Also

update_material_dropdown

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
material_dropdown(
  input_id = "example_dropdown",
  label = "Drop down",
  choices = c(
    "Chicken" = "c",
    "Steak" = "s",
    "Fish" = "f"
  ),
  selected = c("c"),
  multiple = FALSE,
  color = "#ef5350"
)

Example output

<div class="input-field" id="shiny-material-dropdown-example_dropdown">
  <select id=example_dropdown class='shiny-material-dropdown'>
  <option value=c selected>&nbsp;Chicken</option>
  <option value=s>&nbsp;Steak</option>
  <option value=f>&nbsp;Fish</option>
  </select>
  <label>Drop down</label>
</div>

shinymaterial documentation built on Sept. 1, 2020, 1:07 a.m.