Skip to content

Commit

Permalink
Get rid of inline argument; improve Rd docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Jun 26, 2023
1 parent e0aa340 commit 34f1c8f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions R/input-switch.R
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
#' Create a switch input
#' Switch input control
#'
#' @param id an input id.
#' @param label a label for the switch.
#' @param value whether or not the switch should be checked by default.
#' @param width a valid CSS unit defining the width.
#' Create a switch control used to specify logical values.
#'
#' @param id An input id.
#' @param label A label for the switch.
#' @param value Whether or not the switch should be checked by default.
#' @param width Any valid [CSS unit][htmltools::validateCssUnit] (e.g.,
#' `width="200px"`).
#' @export
input_switch <- function(id, label, value = FALSE, width = NULL, inline = TRUE) {
tag <- input_checkbox(id, label, class = "form-check form-switch", value = value, width = width, inline = inline)
input_switch <- function(id, label, value = FALSE, width = NULL) {
tag <- input_checkbox(id, label, class = "form-check form-switch", value = value, width = width)
tag <- tag_require(tag, version = 5, caller = "input_switch()")
as_fragment(tag)
}

#' @rdname input_switch
#' @inheritParams nav_insert
#' @export
update_switch <- function(id, label = NULL, value = NULL, session = shiny::getDefaultReactiveDomain()) {
update_switch <- function(id, label = NULL, value = NULL, session = get_current_session()) {
message <- dropNulls(list(label = label, value = value))
session$sendInputMessage(id, message)
}
Expand Down

0 comments on commit 34f1c8f

Please sign in to comment.