bs_select: Create a HTML select tag configured with Bootstrap classes

View source: R/bsTools2.R

bs_selectR Documentation

Create a HTML select tag configured with Bootstrap classes

Description

Learn more at https://getbootstrap.com/docs/5.1/forms/overview/.

Usage

bs_select(
  ...,
  id,
  label = NULL,
  text = NULL,
  multiple = FALSE,
  required = FALSE,
  div_attr = NULL,
  select_attr = c(class = "form-select"),
  label_attr = c(class = "form-label"),
  text_attr = c(class = "form-text")
)

Arguments

...

A string or strings of HTML to pass to html5::select(), most likely a sequence of option tags.

id

A string, the id/name for the select, passed to the id and name attributes of the <select> tag.

label

A string, the label to use for the select, passed to html5::label().

text

A string, text or HTML to display with the select and label tags.

multiple

TRUE/FALSE, if TRUE, adds the "multiple" attribute to the select tag.

required

TRUE/FALSE, if TRUE, will add the required attribute to the select tag.

div_attr

A named list or named vector, names are attribute names and values are attribute values. Passed to the attr parameter of html5::div, wrapping the select, label, and text.

select_attr

A named list or named vector, names are attribute names and values are attribute values. Passed to the attr parameter of html5::select.

label_attr

A named list or named vector, names are attribute names and values are attribute values. Passed to the attr parameter of html5::label.

text_attr

A named list or named vector, names are attribute names and values are attribute values. Passed to the attr parameter of html5::div, which will display the text parameter.

Value

A string of HTML.

Examples

bs_select(
option(attr = c(value = 1), "Option One"),
option(attr = c(value = 2), "Option Two"),
id = "example1",
label = "Example Select Input"
)

bsTools documentation built on Aug. 30, 2022, 1:08 a.m.

Related to bs_select in bsTools...