bs_input: Create a HTML input tag configured with Bootstrap classes

View source: R/bsTools2.R

bs_inputR Documentation

Create a HTML input tag configured with Bootstrap classes

Description

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

Usage

bs_input(
  id,
  type = "text",
  value = NULL,
  placeholder = NULL,
  label = NULL,
  text = NULL,
  required = FALSE,
  div_attr = NULL,
  input_attr = c(class = "form-control"),
  label_attr = c(class = "form-label"),
  text_attr = c(class = "form-text"),
  inline = FALSE
)

Arguments

id

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

type

A string, the type of input to create, passed to the type attribute of the <input> tag.

value

A string, the value of the input, passed to the value attribute of the <input> tag.

placeholder

A string, passed to the placeholder attribute of the <input> tag.

label

A string, passed to the <label> tag.

text

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

required

TRUE/FALSE, if TRUE, will add the required attribute to the input 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 input, label, and text.

input_attr

A named list or named vector, names are attribute names and values are attribute values. Passed to the attr parameter of html5::input, but id (also name), type, value, and placeholder have their own parameters.

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.

inline

TRUE/FALSE, if TRUE, adds a div and classes to display the label, input, and text in the same line.

Value

A string of HTML.

Examples

bs_input(
id = "example1",
label = "Example Text Input"
)

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

Related to bs_input in bsTools...