bs_set_data {bsplus}R Documentation

Sets Bootstrap data- and aria- attributes.

Description

Helper function to manage attributes for Bootstrap's JavaScript components.

Usage

bs_set_data(tag, ...)

bs_set_aria(tag, ...)

Arguments

tag

⁠htmltools::[tag][htmltools::tag]⁠

...

named arguments used to set the attributes of tag

Details

One of the mechanisms used by the API for Boostrap JavaScript-components is an html elements' attributes. These attribute names are prefixed with "data-" or "aria-", depending on the function.

When expressed in html, attributes themselves have the properties:

The purpose of this function is to let you express these values in ways familiar to you as an R user. For example:

Note that this returns a modified copy of the tag sent to it, so it is pipeable.

Value

⁠htmltools::[tag][htmltools::tag]⁠, modified copy of tag

See Also

Bootstrap JavaScript Components

Examples

library("htmltools")
library("lubridate")

tags$div() %>%
  bs_set_data(
    target = "#foobar",
    delay = dseconds(1),
    placement = c("right", "auto")
  ) %>%
  bs_set_aria(expanded = FALSE)

[Package bsplus version 0.1.4 Index]