Skip to contents

The goal of shinyVirga is to consolidate generalized utility functions useful in development of shiny apps that are currently used in the various Virga Labs repositories in one convenient location. shinyVirga is intended to supply Virga Labs developers with a toolkit of well-maintained functions and modules adaptable to various use cases encountered likely to be encountered during shiny development with Virga Labs.

Installation

You can install the development version of shinyVirga like so:

virgaUtils::install_virga("shinyVirga")

The utility functions are divided into five categories (some functions overlap categories):

Name Concept Title Description
card_grid Create a gridded card layout Creates a grid layout informed by the https://miro.com/app/board/o9J_l90QVck=/?moveToWidget=3074457361986467451&cot=14design spec
dbg_msg Print a debug message to the R and Javascript Console Print a debug message to the R and Javascript Console
glossarize Add definitions to acronyms Uses the https://docs.google.com/spreadsheets/d/163ArY3cL67Vp-gzqjKSw_4r2kl-pCqMRsKDrK_zgbM0/edit#gid=0glossary to make tooltip definitions
glossary_sync Update the Virga Labs glossary Update the Virga Labs glossary
grid_card Wrap in a bs4Card with default options Wraps in a width 12 card, converts the title to an ID by replacing spaces with _. Adds a tip_icon if a tip named with the title exists in tips.
has_card Is a shiny.tag or shiny.tag.list have a Bootstrap card in the nesting structure? Is a shiny.tag or shiny.tag.list have a Bootstrap card in the nesting structure?
is_card Is a shiny.tag or shiny.tag.list a Bootstrap card? Is a shiny.tag or shiny.tag.list a Bootstrap card?
nm_to_id Convert a string to a valid HTML ID Convert a string to a valid HTML ID
Re-imports Re-imports Useful functions from other packages
reexports Objects exported from other packages

These objects are imported from other packages. Follow the links below to see their documentation.

htmltoolstags

rlang%|%, %||%

shinyisolate, reactiveValues, reactiveValuesToList

UU%|0|%, %|legit|%, %|try|%, %|zchar|%, write_dir_fn
row_wrap.list S3 Method for row_wrap list S3 Method for row_wrap list
row_wrap.shiny.tag.list S3 Method for row_wrap shiny.tag.list S3 Method for row_wrap shiny.tag.list
row_wrap.shiny.tag S3 Method for row_wrap shiny.tag S3 Method for row_wrap shiny.tag
shinyVirga-package shinyVirga: A Collection of R shiny utilities by Virga Labs A collection of useful utility functions for working with shiny and shiny frameworks
simpleCard Construct a simple Bootstrap card Construct a simple Bootstrap card
add_sass css Translate inline Sass to CSS style tag Translate inline Sass to CSS style tag
css_props css R List to CSS declarations as a string R List to CSS declarations as a string
list2sass css Conver a list or vector to Sass variables Conver a list or vector to Sass variables
browser_server debugging Add the observeEvent call for a hidden ui browser button. Add the observeEvent call for a hidden ui browser button.
browser_ui debugging Add the invisible browser button ui component Add the invisible browser button ui component
msg_mod_fun debugging Display the name of the parent module Stack traces often aren’t available in Shiny. Use this function inside of modules to know where errors occur
use_msg_mod_fun debugging Insert module debugging statements throughout module files. Insert module debugging statements throughout module files.
deploy_stage deploy Run Deployment as a background task Run Deployment as a background task
deploy_tar deploy Create a staging directory for deployment files Create a staging directory for deployment files
is_shiny.tag general Is object a shiny tag or tagList Is object a shiny tag or tagList
ns_custom general Create a custom namespace string. Useful for referencing objects nested in adjacent modules
ns_find general Retrieve the ns function Designed to find the ns function from any level of nesting within a UI or Server module. htmlhttps://lifecycle.r-lib.org/articles/stages.html#experimentallifecycle-experimental.svgoptions: alt=‘[Experimental]’[Experimental]
path_strip_shiny general Strip a file path to everything after resourcepath if shiny is running Useful for linking to internal files, such as with image source attributes <img src=“[path]”>
path_strip_to general Strip a file path to everything after resourcepath Useful for linking to internal files, such as with image source attributes <img src=“[path]”>
tab_ns_extract general Extract the tabname to which this module instance corresponds from the ns Extract the tabname to which this module instance corresponds from the ns
warn_id general Display a warning in a DOM element of choice Display a warning in a DOM element of choice
enurl golem Create an url Create an url
jq_hide golem Hide an element by calling jquery hide on it Hide an element by calling jquery hide on it
list_to_li golem Turn an R list into an HTML list Turn an R list into an HTML list
list_to_p golem Turn an R list into corresponding HTML paragraph tags Turn an R list into corresponding HTML paragraph tags
make_action_button golem Make the current tag behave like an action button Make current tag behave like an action button. htmlhttps://lifecycle.r-lib.org/articles/stages.html#experimentallifecycle-experimental.svgoptions: alt=‘[Experimental]’[Experimental]
rep_br golem Repeat tagsbr < /td >  < td > Repeattagsbr
tagRemoveAttributes golem Remove a tag attribute Remove a tag attribute
undisplay golem Hide or display a tag Hide or display a tag
with_red_star golem Add a red star at the end of the text Adds a red star at the end of the text (for example for indicating mandatory fields).
js_after JS Add a temporary message after an element Message is added directly below element and persists for three seconds Add a temporary message after an element Message is added directly below element and persists for three seconds
js_callback JS Create an anonymous JS function to monitor an event and bind it to a shiny input Create an anonymous JS function to monitor an event and bind it to a shiny input
js_callout JS Create a driver.js callout Must include shinyVirga::use_driver.js() in the head of the page. Create a driver.js callout Must include shinyVirga::use_driver.js() in the head of the page.
js_glow JS Add an animated glow to an element Add an animated glow to an element
js_mouseover_once JS Make a shiny input with named ID with a logical TRUE value when the element is moused over. Make a shiny input with named ID with a logical TRUE value when the element is moused over.
js_set_input_val JS Create a javascript callback that runs when shiny connects. Create a javascript callback that runs when shiny connects.
use_driver.js JS Add driver.js dependency Add driver.js dependency
rv_index reactives Index into a reactiveValues object and return a list Index into a reactiveValues object and return a list
rv_to_list reactives Convert a reactiveValues object to a list Convenience wrapper around reactiveValuesToList
rv reactives Create an object for storing reactive values This function returns an object for storing reactive values. It is similar to a list, but with special capabilities for reactive programming. When you read a value from it, the calling reactive expression takes a reactive dependency on that value, and when you write to it, it notifies any reactive functions that depend on that value. Note that values taken from the reactiveValues object are reactive, but the reactiveValues object itself is not.
acc_list ui Create an accordion from a list of items Create an accordion from a list of items
box_list ui Create boxes around a list of shiny.tags Create boxes around a list of shiny.tags
bs_extract_status ui Extract the bootstrap status of a Bootstrap tag that uses the status in the class Extract the bootstrap status of a Bootstrap tag that uses the status in the class
bs_statuses ui Valid Bootstrap Statuses Valid Bootstrap Statuses
bs4Alert ui Create a bootstrap 4 Alert box Create a bootstrap 4 Alert box
col_1 ui Create a column of width 1 Create a column of width 1
col_10 ui Create a column of width 10 Create a column of width 10
col_11 ui Create a column of width 11 Create a column of width 11
col_12 ui Create a column of width 12 Create a column of width 12
col_2 ui Create a column of width 2 Create a column of width 2
col_3 ui Create a column of width 3 Create a column of width 3
col_4 ui Create a column of width 4 Create a column of width 4
col_5 ui Create a column of width 5 Create a column of width 5
col_6 ui Create a column of width 6 Create a column of width 6
col_7 ui Create a column of width 7 Create a column of width 7
col_8 ui Create a column of width 8 Create a column of width 8
col_9 ui Create a column of width 9 Create a column of width 9
col_auto ui Render an auto-sized column Render an auto-sized column
copyright ui Creates an always up to date italicized copyright element. Creates an always up to date italicized copyright element.
dynamic_row ui Create a row with columns that dynamically resize Must use div(class = ‘column’, …) or col_auto() for internal columns to function properly. Create a row with columns that dynamically resize Must use div(class = ‘column’, …) or col_auto() for internal columns to function properly.
fa_arrow_icon ui FontAwesome Arrow Icons FontAwesome Arrow Icons
icon_sb ui Wrapper for icon that supports svg images Wrapper for icon that supports svg images
infoIcon ui A small info icon with a tooltip Requires use_tippy to be placed in the head of the app. See the [tippy docs]https://github.com/JohnCoene/tippy for details
make_columns ui Make columns from assorted shiny.tag elements Sorts shiny.tags into columns based on the maximum number of columns (max_cols) per row. htmlhttps://lifecycle.r-lib.org/articles/stages.html#experimentallifecycle-experimental.svgoptions: alt=‘[Experimental]’[Experimental]
ui_row ui A default full width row box. A default full width row box.
ui_tabs ui Create a shiny.tag.list of bs4SidebarMenuItems with an input tibble Create a shiny.tag.list of bs4SidebarMenuItems with an input tibble
write_col_fns ui Writes convenient wrappers around column(12, …), column(6, …), column(4, …)… named col_1, col_2 etc. Write wrappers Write wrappers