actionButtonStyled: Action Button but with customized styles

Description Usage Arguments Value See Also Examples

View source: R/shiny-actionbutton-styled.R

Description

Action Button but with customized styles

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
actionButtonStyled(
  inputId,
  label,
  icon = NULL,
  width = NULL,
  type = "primary",
  btn_type = "button",
  class = "",
  ...
)

Arguments

inputId, label, icon, width, ...

passed to shiny::actionButton

type

button type, choices are 'default', 'primary', 'info', 'success', 'warning', and 'danger'

btn_type

HTML tag type, either "button" or "a"

class

additional classes to be added to the button

Value

'HTML' tags

See Also

updateActionButtonStyled for how to update the button.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# demo('example-actionButtonStyled', package='dipsaus')

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])
  })
}


if( interactive() ){
  shinyApp(ui, server, options = list(launch.browser=TRUE))
}

dipsaus documentation built on Sept. 6, 2021, 5:08 p.m.