Description Usage Arguments Details Value Examples
A modal widget.
1 2 3 4 5 6 7 8 9 | chakraModal(
inputId,
options = chakraModalOptions(),
openButton,
isOpen = FALSE,
header,
body,
footer
)
|
inputId |
widget id |
options |
named list of options created with
|
openButton |
a Chakra button to open the modal |
isOpen |
whether the modal is initially open |
header |
a |
body |
a |
footer |
a |
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("Close", action = "close", value = "CLOSE")
, clicking
this button will close the modal and will set the Shiny value
"CLOSE"
. Other possible action attributes are "cancel"
to
cancel, "disable"
to disable the modal, and
"remove"
to entirely remove the modal.
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 | library(shiny)
library(shinyChakraUI)
ui <- chakraPage(
br(),
chakraComponent(
"mycomponent",
chakraModal(
inputId = "modal",
openButton = Tag$Button(
colorScheme = "orange",
"Open Modal"
),
header = Tag$ModalHeader(
fontSize = "lg",
fontWeight = "bold",
"Modal title"
),
body = Tag$ModalBody(
"Sit nulla est ex deserunt exercitation anim occaecat."
),
footer = Tag$ModalFooter(
Tag$ButtonGroup(
spacing = "3",
Tag$Button(
action = "close",
value = "CLOSE",
"Close"
),
Tag$Button(
action = "cancel",
colorScheme = "red",
"Cancel"
)
)
)
)
)
)
server <- function(input, output, session){
observe({
print(input[["modal"]])
})
}
if(interactive()){
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.