bs_dropdown {bsTools}R Documentation

Create a Bootstrap dropdown

Description

Create a Bootstrap dropdown

Usage

bs_dropdown(
  id,
  items = list(),
  button_label = "Dropdown Button",
  dropdown_class = "dropdown",
  button_class = "btn btn-secondary dropdown-toggle",
  ul_class = "dropdown-menu",
  li_class = NULL,
  a_class = "dropdown-item"
)

Arguments

id

A string, the id to use for the dropdown, must be unique within a page (if you have multiple dropdowns on a page).

items

A named list, names become the href for each item, values should be the text to display for each href. If an item is unnamed, the value does not get passed to the li/a tags and is instead displayed as-is (useful for displaying custom HTML content in the dropdown).

button_label

A string, the label to use for the dropdown toggle button.

dropdown_class

A string, the class of the div wrapping the dropdown elements.

button_class

A string, the class of the button controlling the dropdown toggle.

ul_class

A string, default class used for the "ul" tag wrapping the dropdown nav elements.

li_class

A string, default class used for the "li" tags wrapping the dropdown nav elements if the input list item is named.

a_class

A string, default class used for the "a" tags wrapping the dropdown nav elements if the input list item is named.

Value

A string of HTML.

Examples

bs_dropdown(
id = "drop",
items = list(
  "#" = "Home",
  "#" = "About",
  "#" = "Other"
)
)

[Package bsTools version 0.1.0 Index]