Skip to content

Toast plus auto hide minus the countdown progress bar #1343

Description

@kentqin-cve

It would be nice to have an option to hide the countdown progress bar without losing the auto-hide functionality. Currently my hacky workaround (below) is to pre-schedule a later::later() to teardown of the toast. If there's a clean way through the API, that would be most appreciated.

observeEvent(input$trigger, {
  # 1. Define a unique tracking tag for the notification
  my_toast_id <- "server_timed_toast"
  
  # 2. Show the toast with duration_s = NULL to guarantee NO progress line elements 
  show_toast(
    toast(
      "This notification has no countdown bar and is closed by the server.",
      header = "No countdown bar",
      id = my_toast_id,    # Explicit handle tag
      duration_s = NULL    # Skip the timer
    )
  )
  
  # 3. Schedule the server to hide this specific toast after exactly 3 seconds
  later::later(\() {
    hide_toast(id = my_toast_id,session=session) 
  }, delay = 3)
  
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: LowLow-impact bug, docs polish, papercut, or unclear low-severity request.ai-triage:doneMarks an issue whose AI triage workflow is complete.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions