Title: | utilitybeltshiny |
---|---|
Description: | Assorted utilities for building shiny apps. |
Authors: | Sam El-Kamand [cre, aut] |
Maintainer: | Sam El-Kamand <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9000 |
Built: | 2024-10-27 03:04:15 UTC |
Source: | https://github.com/selkamand/utilitybeltshiny |
assert_reactive
assert_non_reactive(object, msg = "")
assert_non_reactive(object, msg = "")
object |
object to test |
msg |
msg to be appended to the hard-coded default (string) |
invisible (TRUE) if expression is TRUE. Will error if is FALSE
assert_reactive
assert_reactive(object, msg = "")
assert_reactive(object, msg = "")
object |
object to test |
msg |
msg to be appended to the hard-coded default (string) |
invisible (TRUE) if expression is TRUE. Will error if is FALSE
Stops the app running if a user closes their web browser. Useful if distributing your app as a desktop / electron app.
Should be placed in the server function
close_app_on_browser_exit()
close_app_on_browser_exit()
WARNING: Not working ATM
This function takes some UI element and a compiletime-evaluated expression and returns the UI element ONLY if the condition is true
conditionalUI(expression, ui_element)
conditionalUI(expression, ui_element)
expression |
compile-time evaluated expression (no server/reactive variables) |
ui_element |
the UI element to display if |
WARNING: Do NOT use this function for runtime-dynamic UI elements. Only works with compiletime variables. For dynamic UI see ?shiny::conditionalPanel()
if expression==TRUE: taglist wrapping passed UI element. If expression == FALSE, empty taglist
#In UI: somevariable=TRUE shinyWidgets::panel(heading="constitutivepanel", conditionalUI(somevariable, shinyWidgets::panel(somevariable, heading="ConditionalPanel")), shiny::h1("constitutive title"), shiny::p("constitutive paragraph") )
#In UI: somevariable=TRUE shinyWidgets::panel(heading="constitutivepanel", conditionalUI(somevariable, shinyWidgets::panel(somevariable, heading="ConditionalPanel")), shiny::h1("constitutive title"), shiny::p("constitutive paragraph") )
Downloads a dataframe or datatable.
mod_download_dataframe_server( id, data_to_write, filename_full, rownames = FALSE, colnames = TRUE )
mod_download_dataframe_server( id, data_to_write, filename_full, rownames = FALSE, colnames = TRUE )
id |
Internal parameters for shiny |
data_to_write |
dataframe or datatable (dataframe / data.table) (can be a reactive or non-reactive object) |
filename_full |
Name to save file under. Include any extensions (string) |
rownames |
Save row names? (boolean) |
colnames |
Save column names? (boolean) |
None, Run for its side effects. Downloads a dataframe/data.table to the local machine.
A shiny module that adds a download button to
mod_download_dataframe_ui( id, label = "Download", tooltip_text = "", tooltip_pos = "right", style = "unite", color = "default", size = "sm" )
mod_download_dataframe_ui( id, label = "Download", tooltip_text = "", tooltip_pos = "right", style = "unite", color = "default", size = "sm" )
id |
Internal parameters for shiny |
label |
The label that should appear on the button. |
tooltip_text |
text to appear when cursor hovers over download button (string) |
tooltip_pos |
Where the tooltip should appear relative to its target (top, bottom, left, or right). Defaults to "right" |
style |
Style of the button, to choose between |
color |
Color of the button : |
size |
Size of the button : |
Run the Shiny Application
run_app(onStart = NULL, options = list(), enableBookmarking = NULL, ...)
run_app(onStart = NULL, options = list(), enableBookmarking = NULL, ...)
onStart |
A function that will be called before the app is actually run.
This is only needed for |
options |
Named options that should be passed to the |
enableBookmarking |
Can be one of |
... |
arguments to pass to golem_opts |