Scroll a message-scroller to the latest message
Source:R/tier3-message-scroller.R
shad_message_scroller_to_bottom.RdRe-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.
See also
Other shadshiny server API:
bind_shad_task_button(),
shad_overlay_server,
shad_remove_dialog(),
shad_show_dialog(),
shad_toast(),
update_shad,
update_shad_command()
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)
}