demo/example-actionButtonStyled.R

library(shiny)
library(dipsaus)

ui <- fluidPage(
  actionButtonStyled("btn", label = "Click me", type = "default"),
  actionButtonStyled("btn2", label = "Click me2", type = "primary"),
)


server <- function(input, output, session) {
  btn_types <- c("default", "primary", "info", "success", "warning", "danger")
  observeEvent(input$btn, {
    btype <- btn_types[((input$btn - 1) %% (length(btn_types) - 1)) + 1]
    updateActionButtonStyled(session, "btn2", type = btype)
  })
  observeEvent(input$btn2, {
    updateActionButtonStyled(session, "btn", disabled = c(FALSE, TRUE)[(input$btn2 %% 2) + 1])
  })
}

shinyApp(ui, server, options = list(launch.browser = TRUE))

Try the dipsaus package in your browser

Any scripts or data that you put into this service are public.

dipsaus documentation built on May 23, 2026, 9:09 a.m.