unstrap: Remove bootstrap css from crosstalk components

Description Usage Arguments Value Examples

View source: R/unstrap.R

Description

If your page renders weirdly, it might be because a crosstalk component like crosstalk::filter_select() is injecting unexpected css into your page, which happens because they try to use the Bootstrap css library by default. The unstrap() function prevents that from happening.

Usage

1

Arguments

x

a crosstalk component, such as crosstalk::filter_select()

Value

The component x but with any "boostrap" dependency removed from its html_dependencies attribute.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# The fs object will inject css into your page.
if (requireNamespace("crosstalk", quietly = TRUE)) {
  df <- crosstalk::SharedData$new(mtcars)

  fs <- crosstalk::filter_select(
      id = "myselector",
      label = "select something",
      sharedData = df,
      group = ~cyl
    )

  # The fs_nobootstrap object won't inject css into your page.
  fs_nobootstrap <- unstrap(fs)
}

Example output



govdown documentation built on March 10, 2021, 5:07 p.m.