createStandaloneToast {shinyChakraUI} | R Documentation |
The 'createStandaloneToast' hook
Description
The 'createStandaloneToast' hook.
Usage
createStandaloneToast()
Details
See Standalone toasts.
Value
A list containing some URL-encoded JavaScript code.
Examples
library(shiny)
library(shinyChakraUI)
ui <- chakraPage(
br(),
chakraComponent(
"mycomponent",
withStates(
Tag$Button(
colorScheme = "orange",
size = "lg",
onClick = jseval(paste(
'() => {',
' const toast = getState("toast");',
' toast({',
' position: "bottom",',
' title: "Account created.",',
' description: "We have created your account for you.",',
' status: "success",',
' duration: 3000,',
' isClosable: true',
' });',
'}',
sep = "\n")),
"Show toast"
),
states = list(toast = createStandaloneToast())
)
)
)
server <- function(input, output, session){}
if(interactive()){
shinyApp(ui, server)
}
[Package shinyChakraUI version 1.1.1 Index]