Learn R Programming

yonder (version 0.1.0)

radioInput: Radio inputs

Description

Create a reactive radio input of one or more radio controls.

Usage

radioInput(id, choices, values = choices, selected = values[[1]], ...,
  inline = FALSE)

radiobarInput(id, choices, values = choices, selected = values[[1]], ...)

Arguments

id

A character string specifying the id of the reactive input.

choices

A character vector specifying labels for the radio or radiobar input's choices.

values

A character vector, list of character strings, vector of values to coerce to character strings, or list of values to coerce to character strings specifying the values of the radio input's choices, defaults to choices.

selected

One of values indicating the default selected value of the radio input, defaults to NULL, in which case the first choice is selected by default.

...

Additional named arguments passed as HTML attributes to the parent element.

inline

If TRUE, the radio input renders inline, defaults to FALSE, in which case the radio controls render on separate lines.

See Also

Other inputs: buttonGroupInput, buttonInput, checkboxInput, chipInput, fileInput, formInput, groupInput, listGroupInput, menuInput, navInput, rangeInput, selectInput, sliderInput, textInput

Examples

Run this code
# NOT RUN {
### Out-of-the-box radios

radioInput(
  id = "radio1",
  choices = c(
    "Vehicula adipiscing mattis",
    "Magna nullam",
    "Aenean venenatis",
    "Tristique quam porta"
  )
)

### Inline radio input

radioInput(
  id = "radio2",
  choices = c(
    "Choice 1",
    "Choice 2",
    "Choice 3"
  ),
  inline = TRUE  # <-
)

### Radiobars in comparison

radiobarInput(
  id = "radiobar1",
  choices = c(
    "fusce sagittis",
    "libero non molestie",
    "magna orci",
    "ultrices dolor"
  ),
  selected = "ultrices dolor"
) %>%
  background("grey")

# }

Run the code above in your browser using DataLab