Package 'scoutbaR'

Title: A Spotlight 'React' Widget for 'shiny' Apps
Description: Creates a contextual menu that can be triggered with keyboard shortcuts or programmatically. This can replace traditional sidebars or navigation bars, thereby enhancing the user experience with lighter user interfaces.
Authors: David Granjon [aut, cre], Adenekan Wonderful [cph] (Scoutbar React library: <https://github.com/adenekan41/scoutbar>)
Maintainer: David Granjon <[email protected]>
License: MIT + file LICENSE
Version: 0.0.1
Built: 2024-11-22 05:46:42 UTC
Source: https://github.com/cran/scoutbaR

Help Index


Creates a scout action

Description

Creates an item that can perform actions on the server side.

Usage

scout_action(id, label, description, closeOnClick = TRUE, ...)

Arguments

id

Unique id.

label

Action label.

description

Action description.

closeOnClick

Whether to close the scoutbar whenever this action is clicked. Default to TRUE.

...

Other options. See https://www.scoutbar.co/docs/actions.

Details

This function is meant to be embeded directly within scoutbar or via a more structured way within scout_page or scout_section. It serves as a bridge between R and JavaScript to communicate with the Scoutbar React API, so you are not expected to call it on its own.

Value

A list containing:

  • children: a sublist where are passed the options.

  • class: a character vector to identify the action on the JavaScript side. You are not expected to modify it as it will break the JavaScript binding.


Creates a scout page

Description

Can embed scout_action on a separate view of the Scoutbar.

Usage

scout_page(label, ..., .list = NULL)

Arguments

label

Page label.

...

Expect scout_action.

.list

To programmatically pass a list of scout_action, with lapply for instance.

Details

Whenever many scout_action share a similar topic, or have nested topics, this function allows you to provide a better experience by isolating some actions in a separate view. You can nest pages within other pages and combine it with scout_section.

Value

A list containing:

  • children: a sublist where are passed the scout_action.

  • label: The page label.

  • class: a character vector to identify the page on the JavaScript side. You are not expected to modify it as it will break the JavaScript binding.


Creates a scout section

Description

Sort scout_action on the same view.

Usage

scout_section(label, ..., .list = NULL)

Arguments

label

Section label.

...

Expect scout_action.

.list

To programmatically pass a list of scout_action, with lapply for instance.

Details

Whenever many scout_action share a similar topic, you may use this function to sort them in the UI and offer a better user experience. You can combine it with scout_page.

Value

A list containing:

  • children: a sublist where are passed the scout_action.

  • label: The section label.

  • class: a character vector to identify the section on the JavaScript side. You are not expected to modify it as it will break the JavaScript binding.


Creates a Scoutbar React widget

Description

Scoutbar react widget for Shiny.

Use this function from the server side of your Shiny app to update a scoutbar.

Usage

scoutbar(
  inputId,
  theme = c("light", "dark", "auto"),
  placeholder = list("Hello", "Type some text"),
  actions = list(),
  ...
)

update_scoutbar(session = shiny::getDefaultReactiveDomain(), inputId, ...)

Arguments

inputId

Widget input id.

theme

Scoutbar theme.

placeholder

Scoutbar placeholder text. A string or a list of strings.

actions

Scoutbar actions. Expect scout_action or scout_section and scout_page. scout_action can be nested inside scout_section and scout_page.

...

Scoutbar configuration. Expect a list of properties like in scoutbar. See possible values here at https://www.scoutbar.co/docs/features.

session

Shiny session object.

Details

Provides a contextual menu users can activate with keyboard shortcut or prommatically with update_scoutbar. Scoutbar may be seen as an alternative to sidebars and navbars, as it allows to construct better navigation menus.

Value

A list of shiny tags containing all the web dependencies and scoutbar elements required to instantiate the Scoutbar React widget from JavaScript.

This function is called for its side effect. It sends a message to JavaScript through the current websocket connection, leveraging the shiny session object.