Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JohnCoene/pushbar
🖥️ Off-canvas elements for Shiny
https://github.com/JohnCoene/pushbar
r rstats shiny
Last synced: 27 days ago
JSON representation
🖥️ Off-canvas elements for Shiny
- Host: GitHub
- URL: https://github.com/JohnCoene/pushbar
- Owner: JohnCoene
- License: other
- Created: 2019-02-12T12:06:48.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-11-09T23:11:21.000Z (about 2 years ago)
- Last Synced: 2024-11-10T03:02:20.242Z (about 1 month ago)
- Topics: r, rstats, shiny
- Language: R
- Homepage: https://shiny.john-coene.com/pushbar/
- Size: 198 KB
- Stars: 59
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-shiny-extensions - pushbar - Brings pushbar.js to Shiny. Create off-canvas sliding drawers for inputs, outputs, or any other content. (UI Components / Drawers)
README
[![Travis build status](https://travis-ci.org/JohnCoene/pushbar.svg?branch=master)](https://travis-ci.org/JohnCoene/pushbar)
# pushbar
> See [bsutils](github.com/JohnCoene/bsutils) for a Bootstrap 5 built-in.
Brings [pushbar.js](https://oncebot.github.io/pushbar.js/) to Shiny; create off-canvas sliders for inputs, outputs or any other content.
## Installation
Install the stable version (recommended) from CRAN:
```r
install.packages("pushbar")
```Install the development version with `remotes`
``` r
# install.packages("remotes")
remotes::install_github("JohnCoene/pushbar")
```## How to use
1. Include `pushbar_deps` anywhere in your ui.
2. Include `setup_pushbar` at the top of your server function, it'll also let you determine whether to use `blur` and `overlay` when pushbars are opened.
3. Use `pushbar` in your ui to include content in pushbars.
4. Use `pushbar_open` and `pushbar_close` to 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
[Live Demo](https://shiny.john-coene.com/pushbar)
``` r
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)
```![](pushbar.gif)