https://github.com/cynkra/scoutbar
scoutbar React widget for R and Shiny apps
https://github.com/cynkra/scoutbar
r react scoutbar shiny
Last synced: 6 months ago
JSON representation
scoutbar React widget for R and Shiny apps
- Host: GitHub
- URL: https://github.com/cynkra/scoutbar
- Owner: cynkra
- License: other
- Created: 2024-11-12T14:19:05.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-03-24T08:47:41.000Z (7 months ago)
- Last Synced: 2025-04-12T20:12:29.048Z (6 months ago)
- Topics: r, react, scoutbar, shiny
- Language: R
- Homepage: https://cynkra.github.io/scoutbaR/
- Size: 2.61 MB
- Stars: 23
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# {scoutbaR}
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://github.com/cynkra/scoutbaR/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/cynkra/scoutbaR?branch=main)
[](https://CRAN.R-project.org/package=scoutbaR)The goal of `{scoutbaR}` is to provide an R API to the `scoutbar` React [widget](https://www.scoutbar.co/).

## Installation
You can install the development version of `{scoutbaR}` from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("cynkra/scoutbaR")
```## Example
`{scoutbaR}` is easy to use. The app below shows how to leverage `scout_action()`, `scout_section()` and `scout_page()`:
```r
library(scoutbaR)
library(shiny)
library(bslib)ui <- page_fillable(
title = "Penguins dashboard",
layout_sidebar(
sidebar = sidebar(
input_dark_mode(id = "theme"),
actionButton("update", "Update", icon = icon("house")),
scoutbar(
"scoutbar",
actions = list(
scout_section(
label = "Section 1",
scout_action(
id = 1,
icon = "house",
label = "1",
description = "1"
),
scout_action(
id = 2,
icon = "gear",
label = "2",
description = "2"
)
),
scout_section(
label = "Section 2",
scout_page(
label = "Page 1",
scout_action(
id = 3,
icon = "house",
label = "3",
description = "3"
),
scout_action(
id = 4,
icon = "gear",
label = "4",
description = "4"
)
),
scout_action(
id = 5,
icon = "gear",
label = "5",
description = "5"
)
)
)
),
textOutput("textOutput"),
textOutput("current_tab")
),
"Body"
)
)server <- function(input, output, session) {
observeEvent(input$update, {
update_scoutbar(session, "scoutbar", revealScoutbar = TRUE)
})observeEvent(input$theme, {
update_scoutbar(session, "scoutbar", theme = input$theme)
})
output$textOutput <- renderText({
sprintf("You entered: %s", input$scoutbar)
})
}shinyApp(ui, server)
```