A stylized radio input. A reactive input with multiple choices where only one choice and value at most may be selected.

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

updateRadioInput(
  id,
  choices = NULL,
  values = choices,
  selected = NULL,
  inline = FALSE,
  enable = NULL,
  disable = NULL,
  valid = NULL,
  invalid = NULL,
  session = getDefaultReactiveDomain()
)

Arguments

id

A character string specifying the id of the reactive input.

choices

A character vector or list of tag elements specifying the 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 or tag elements passed as child elements 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.

enable

One of values specifying particular choices to enable or TRUE specifying the entire input is enabled, defaults to NULL.

disable

One of values specifying particular choices to disable or TRUE specifying the entire input is disabled, defaults to NULL.

valid

A character string specifying a message to the user indicating how the input's value is valid, defaults to NULL.

invalid

A character string specifying a message to the user indicating how the input's value is invalid, defaults to NULL.

session

A reactive context, defaults to getDefaultReactiveDomain().

See also

Examples

### Out-of-the-box radios radioInput( id = "radio1", choices = c( "Vehicula adipiscing mattis", "Magna nullam", "Aenean venenatis", "Tristique quam porta" ) )
#> <div class="yonder-radio" id="radio1"> #> <div class="custom-control custom-radio"> #> <input class="custom-control-input" type="radio" id="radio-266-416" name="radio1" value="Vehicula adipiscing mattis" checked autocomplete="off"/> #> <label class="custom-control-label" for="radio-266-416">Vehicula adipiscing mattis</label> #> </div> #> <div class="custom-control custom-radio"> #> <input class="custom-control-input" type="radio" id="radio-117-930" name="radio1" value="Magna nullam" autocomplete="off"/> #> <label class="custom-control-label" for="radio-117-930">Magna nullam</label> #> </div> #> <div class="custom-control custom-radio"> #> <input class="custom-control-input" type="radio" id="radio-529-180" name="radio1" value="Aenean venenatis" autocomplete="off"/> #> <label class="custom-control-label" for="radio-529-180">Aenean venenatis</label> #> </div> #> <div class="custom-control custom-radio"> #> <input class="custom-control-input" type="radio" id="radio-184-22" name="radio1" value="Tristique quam porta" autocomplete="off"/> #> <label class="custom-control-label" for="radio-184-22">Tristique quam porta</label> #> <div class="valid-feedback"></div> #> <div class="invalid-feedback"></div> #> </div> #> </div>
### Inline radio input radioInput( id = "radio2", choices = c( "Choice 1", "Choice 2", "Choice 3" ), inline = TRUE # <- )
#> <div class="yonder-radio" id="radio2"> #> <div class="custom-control custom-radio custom-control-inline"> #> <input class="custom-control-input" type="radio" id="radio-607-897" name="radio2" value="Choice 1" checked autocomplete="off"/> #> <label class="custom-control-label" for="radio-607-897">Choice 1</label> #> </div> #> <div class="custom-control custom-radio custom-control-inline"> #> <input class="custom-control-input" type="radio" id="radio-70-674" name="radio2" value="Choice 2" autocomplete="off"/> #> <label class="custom-control-label" for="radio-70-674">Choice 2</label> #> </div> #> <div class="custom-control custom-radio custom-control-inline"> #> <input class="custom-control-input" type="radio" id="radio-179-686" name="radio2" value="Choice 3" autocomplete="off"/> #> <label class="custom-control-label" for="radio-179-686">Choice 3</label> #> <div class="valid-feedback"></div> #> <div class="invalid-feedback"></div> #> </div> #> </div>