Learn R Programming

shinyChakraUI (version 1.1.1)

createStandaloneToast: The `createStandaloneToast` hook

Description

The `createStandaloneToast` hook.

Usage

createStandaloneToast()

Arguments

Value

A list containing some URL-encoded JavaScript code.

Details

See Standalone toasts.

Examples

Run this code
# NOT RUN {
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)
}
# }

Run the code above in your browser using DataLab