| chakraAlertDialog {shinyChakraUI} | R Documentation |
Alert dialog widget
Description
An alert dialog widget.
Usage
chakraAlertDialog(
inputId,
options = chakraAlertDialogOptions(),
openButton,
header,
body,
footer
)
Arguments
inputId |
widget id |
options |
named list of options created with
|
openButton |
a Chakra button to open the alert dialog |
header |
an |
body |
an |
footer |
an |
Details
You can use an action attribute and a value
attribute to the Chakra buttons you put in the widget. For example, if
you include the Chakra button
Tag$Button("Cancel", action = "cancel", value = "CANCEL"), clicking
this button will cancel the alert dialog and will set the Shiny value
"CANCEL". Other possible action attributes are "close" to
close the alert dialog, "disable" to disable the alert dialog, and
"remove" to entirely remove the widget.
Value
A widget that can be used in chakraComponent.
Examples
library(shiny)
library(shinyChakraUI)
ui <- chakraPage(
br(),
chakraComponent(
"mycomponent",
chakraAlertDialog(
inputId = "alertDialog",
openButton = Tag$Button(
leftIcon = Tag$DeleteIcon(),
colorScheme = "red",
"Delete customer"
),
header = Tag$AlertDialogHeader(
fontSize = "lg",
fontWeight = "bold",
"Delete customer?"
),
body = Tag$AlertDialogBody(
"Are you sure? You can't undo this action afterwards."
),
footer = Tag$AlertDialogFooter(
Tag$ButtonGroup(
spacing = "3",
Tag$Button(
action = "cancel",
value = "CANCEL",
"Cancel"
),
Tag$Button(
action = "disable",
value = "DISABLE",
colorScheme = "red",
"Disable"
),
Tag$Button(
action = "remove",
value = "REMOVE",
"Remove"
)
)
)
)
)
)
server <- function(input, output, session){
observe({
print(input[["alertDialog"]])
})
}
if(interactive()){
shinyApp(ui, server)
}