R/bulma-form-button.R

Defines functions bulma_form_button

Documented in bulma_form_button

#' @title
#' Bulma Form: Button
#'
#' @description
#' A button for the form. This has the same characteristics as
#' [`bulma_button()`] but specific to forms (tag of `<button>`).
#'
#' @param name  (str) identifier for submissions; defaults to submit
#' @param type  (str) what type of input; defaults to submit
#' @param value (str) the label for the button
#' @inheritParams bulma_button
#'
#' @family Bulma Form Components
#' @seealso bulma_button
#' @export
bulma_form_button <- function(name  = "submit",
                              value = name,
                              ...,
                              type  = c("button", "submit", "reset"),
                              color = c("primary", "link", "info",
                                        "success", "warning", "danger",
                                        "white", "black", "light", "dark",
                                        "ghost", "text"),
                              shade = c("light", "dark"),
                              size  = c("small", "medium", "large", "normal"),
                              state =  c("hovered", "focused", "active",
                                         "loading", "static"),
                              full_width = FALSE,
                              outlined = FALSE,
                              inverted = FALSE,
                              rounded = FALSE,
                              disabled = FALSE,
                              tag = tags$input) {

  assert_string(name)
  type <- match_arg(type) %||% "button"
  assert_string(type)
  bulma_button(
    ...,
    value = value,
    type = type, name = name,
    color = color, shade = shade, size = size, state = state,
    full_width = full_width, outlined = outlined, inverted = inverted,
    rounded = rounded, disabled = disabled,
    tag = tag
  ) %>%
    add_class("bulma_form_button")

}
tjpalanca/bulma.R documentation built on Dec. 23, 2021, 10:58 a.m.