Skip to contents

Re-attaches to the live edge and scrolls to the bottom. Call after appending rows (e.g. via shiny::insertUI()) to follow a streaming reply.

Usage

shad_message_scroller_to_bottom(
  id,
  smooth = TRUE,
  session = shiny::getDefaultReactiveDomain()
)

Arguments

id

The shad_message_scroller() id (namespaced automatically).

smooth

If TRUE (default), animate the scroll.

session

The Shiny session.

Value

Invisibly NULL; called for its side effect.

Examples

if (interactive()) {
  ui <- page_shad(
    shad_message_scroller(
      "log", height = 300,
      shad_message_scroller_item(shad_bubble("First message"))
    ),
    shad_button("Jump to latest", inputId = "jump")
  )
  server <- function(input, output, session) {
    shiny::observeEvent(input$jump, shad_message_scroller_to_bottom("log"))
  }
  shiny::shinyApp(ui, server)
}