rstudio / rstudio/bslib

Toast plus auto hide minus the countdown progress bar

Open
#1,343 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ai-triage:done Priority: Low
Dominant language
SCSS
Stars
569
Forks
72
Avg merge
1d 2h
Merged PRs (30d)
5

Description

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)
  
})

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the show_toast(), toast(), and hide_toast() entry points shown in the issue, and trace how duration_s controls the countdown bar and dismissal. Done means an API option can suppress the progress bar while preserving automatic hiding; verify that behavior for a toast shown through these calls.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, scss
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.