Shiny Module that creates a special DEBUG
button to toggle the browser()
function in a Shiny application.
shiny_debug_button_ui()
: Creates the UI for the Shiny Debug Button.
shiny_debug_button_server()
: Handles the server-side logic for the Shiny Debug Button.
Usage
shiny_debug_button_ui(
id = "browser",
label = "Debug",
icon = shiny::icon("bug"),
hide = TRUE,
keyboard_shortcut = "Ctrl + Alt + D"
)
shiny_debug_button_server(id = "browser")
Details
The shiny_debug_button_ui
function creates a hidden button in the Shiny UI that can be toggled to run the browser()
function.
The shiny_debug_button_server
function contains the server-side logic to handle the button's functionality.
This function creates a button that can be used to toggle the browser()
function in a Shiny application.
The button is hidden by default and can be toggled by pressing the keyboard shortcut Ctrl + Alt + D
(or whatever the user specifies via the keyboard_shortcut
argument).
Functions
shiny_debug_button_ui
Creates the button UI.
shiny_debug_button_server
Handles server-side logic.
Examples
# launch a shiny app with an interactive debug button
# that can be toggled on and off via keyboard shortcut
# the default keyboard shortcut is Ctrl + Alt + D:
if (interactive()) {
library(shiny)
ui <- fluidPage(
shiny_debug_button_ui(id = "browser_btn", label = "Debug")
)
server <- function(input, output, session) {
shiny_debug_button_server("browser_btn")
}
shinyApp(ui, server)
}