add_selector: Add an HTML select object

Description Usage Arguments Value Examples

View source: R/add_selector.R

Description

Add an HTML select object

Usage

1
2
3
add_selector(sel_id = "ts_1", options = c(Option_1 = "Option #1",
  Option_2 = "Option #2", Option_3 = "Option #3"),
  label = "Select an option:")

Arguments

sel_id

A unique ID for the selector which can be referenced in other places.

options

A named character vector. The elements of the character vector are the text visible in the select object. The names serve as option IDs which can be referenced in other places.

label

The text to display along with the selector.

Value

Lines of HTML text which function as a selector.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Not run: 
# RMarkdown code

```{r add_js, results='asis'}
library(selr)
add_javascript()
```

```{r add_selector, results='asis'}
add_selector(
sel_id = "Language",
options = list("Option_1" = "English",
               "Option_2" = "Hebrew",
               "Option_3" = "Pirate")
)
```

```{r, results='asis'}
sel_text(
sel_id = "Language",
options = list("Option_1" = "Hello",
               "Option_2" = "Shalom",
               "Option_3" = "Ahoy")
)
```

## End(Not run)

bschneidr/r_html_select documentation built on April 30, 2021, 8:53 a.m.