See bsutils for a Bootstrap 5 built-in.
Brings pushbar.js to Shiny; create off-canvas sliders for inputs, outputs or any other content.
Installation
Install the stable version (recommended) from CRAN:
install.packages("pushbar")Install the development version with remotes
# install.packages("remotes") remotes::install_github("JohnCoene/pushbar")
How to use
- Include
pushbar_depsanywhere in your ui. - Include
setup_pushbarat the top of your server function, it'll also let you determine whether to useblurandoverlaywhen pushbars are opened. - Use
pushbarin your ui to include content in pushbars. - Use
pushbar_openandpushbar_closeto programatically (server-side) open and close the pushbars.
Also includes an event (see example) to capture whether a pushbar is opened (input$pushbarID_pushbar_opened).
Example
library(shiny) library(pushbar) ui <- fluidPage( pushbar_deps(), br(), actionButton("open", "Open pushbar"), pushbar( h4("HELLO"), id = "myPushbar", # add id to get event actionButton("close", "Close pushbar") ), fluidRow( column(5), column(5, span("Is a pushbar opened?"), verbatimTextOutput("ev")) ) ) server <- function(input, output, session){ setup_pushbar() # setup observeEvent(input$open, { pushbar_open(id = "myPushbar") }) observeEvent(input$close, { pushbar_close() }) output$ev <- renderPrint({ input$myPushbar_pushbar_opened }) } if(interactive()) shinyApp(ui, server)

