Description Usage Arguments Details Value Examples
View source: R/chakraAlertDialog.R
An alert dialog widget.
1 2 3 4 5 6 7 8 | chakraAlertDialog(
inputId,
options = chakraAlertDialogOptions(),
openButton,
header,
body,
footer
)
|
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 |
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.
A widget that can be used in chakraComponent
.
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | 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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.