Skip to contents

Factory function for creating small outline-style action buttons. Handles disabled state rendering gracefully for demo mode or unavailable actions.

Usage

button_factory(
  inputId,
  icon,
  color = "primary",
  isDisabled = FALSE,
  disableRipple = FALSE,
  ...
)

Arguments

inputId

Character scalar. Shiny input ID for the button element.

icon

Shiny icon object from shiny::icon().

color

Character scalar. Bootstrap button color: "primary", "success", "danger", "warning", etc. (default: "primary").

isDisabled

Logical scalar. If TRUE, renders as disabled button tag instead of actionButton. Used for demo mode protection.

disableRipple

Logical scalar. If TRUE, disables material ripple animation effect on button.

...

Additional arguments passed to shiny::actionButton() or button tag.

Value

A shiny.tag button element. Either shiny::actionButton() if enabled, or disabled button tag if isDisabled = TRUE.

Examples

if (FALSE) { # \dontrun{
button_factory("edit_btn", shiny::icon("pen"), color = "success")
button_factory("delete_btn", shiny::icon("trash"), "danger", isDisabled = TRUE)
} # }