create_options: Creates HTML option tags for each position of a list of...

View source: R/webdeveloper.R

create_optionsR Documentation

Creates HTML option tags for each position of a list of values and labels by calling HTML5::option(), returning a string of HTML to pass to a select tag through HTML5::select().

Description

Creates HTML option tags for each position of a list of values and labels by calling HTML5::option(), returning a string of HTML to pass to a select tag through HTML5::select().

Usage

create_options(x, selected = c(), add_blank = FALSE)

Arguments

x

A vector which will become the value/label for each option. If named, names become values.

selected

A value in the vector passed to mark as the initially selected option in the select tag.

add_blank

Boolean, If TRUE, adds a blank option to the top of x.

Value

A string, with an option tag each row of x.

Examples

create_options(
x = c("New York", "Los Angeles", "Chicago"),
selected = "Chicago"
)

webdeveloper documentation built on Oct. 18, 2022, 9:06 a.m.