| Title: | Customise 'Shiny' Disconnected Screens and Error Messages |
|---|---|
| Description: | Customise 'Shiny' disconnected screens as well as sanitize error messages to make them clearer and friendlier to the user. |
| Authors: | John Coene [aut, cre] |
| Maintainer: | John Coene <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.8 |
| Built: | 2026-06-04 09:23:27 UTC |
| Source: | https://github.com/johncoene/sever |
Customise silent error messages: messages raised by shiny::validate() and shiny::need().
If used in combination with cleave() make sure you are setting silent_errors to FALSE.
chisel( html = NULL, color = NULL, bg_color = NULL, duration = NULL, center_vertical = NULL, center_horizontal = NULL, ids = NULL, session = shiny::getDefaultReactiveDomain() )chisel( html = NULL, color = NULL, bg_color = NULL, duration = NULL, center_vertical = NULL, center_horizontal = NULL, ids = NULL, session = shiny::getDefaultReactiveDomain() )
html |
Html content to display instead of error messages,
if |
color |
Color of error message text. |
bg_color |
Background color of error message overlay.
If |
duration |
Duration of animation showing the error message, set to |
center_vertical |
Whether to center the message vertically and horizontally, a |
center_horizontal |
Whether to center the message vertically and horizontally, a |
ids |
Ids of elements to apply the cleave to. If |
session |
A valid shiny session. |
None
Define a theme to apply to all subsequent chisel().
chisel_theme( color = "darkgrey", bg_color = NULL, duration = 0.1, center_vertical = TRUE, center_horizontal = TRUE )chisel_theme( color = "darkgrey", bg_color = NULL, duration = 0.1, center_vertical = TRUE, center_horizontal = TRUE )
color |
Color of error message text. |
bg_color |
Background color of error message overlay.
If |
duration |
Duration of animation showing the error message, set to |
center_vertical |
Whether to center the message vertically and horizontally, a |
center_horizontal |
Whether to center the message vertically and horizontally, a |
None
Customise hard error messages.
cleave( html = NULL, color = NULL, bg_color = NULL, duration = NULL, center_vertical = NULL, center_horizontal = NULL, ids = NULL, silent_errors = FALSE, session = shiny::getDefaultReactiveDomain() )cleave( html = NULL, color = NULL, bg_color = NULL, duration = NULL, center_vertical = NULL, center_horizontal = NULL, ids = NULL, silent_errors = FALSE, session = shiny::getDefaultReactiveDomain() )
html |
Html content to display instead of error messages,
if |
color |
Color of error message text. |
bg_color |
Background color of error message overlay.
If |
duration |
Duration of animation showing the error message, set to |
center_vertical, center_horizontal
|
Whether to center the message vertically and horizontally, a |
ids |
Ids of elements to apply the cleave to. If |
silent_errors |
Set to TRUE to also cleave silent errors: errors that are raised by |
session |
A valid shiny session. |
None
chisel() for soft error messages.
Define a theme to apply to all subsequent cleave().
cleave_theme( color = "red", bg_color = NULL, duration = 0.1, center_vertical = TRUE, center_horizontal = TRUE )cleave_theme( color = "red", bg_color = NULL, duration = 0.1, center_vertical = TRUE, center_horizontal = TRUE )
color |
Color of error message text. |
bg_color |
Background color of error message overlay.
If |
duration |
Duration of animation showing the error message, set to |
center_vertical |
Whether to center the message vertically and horizontally, a |
center_horizontal |
Whether to center the message vertically and horizontally, a |
None
Import dependencies, place this in your shiny UI.
useSever() use_sever()useSever() use_sever()
shiny::tags containing the necessary dependencies.
Create a button to reload/reconnect to shiny.
reconnect_button( text = "reconnect", class = c("default", "danger", "info", "success", "warning") ) reconnect_link( text = "reconnect", class = c("default", "danger", "info", "success", "warning") ) f7_reconnect_button(text = "reconnect", color = "#000")reconnect_button( text = "reconnect", class = c("default", "danger", "info", "success", "warning") ) reconnect_link( text = "reconnect", class = c("default", "danger", "info", "success", "warning") ) f7_reconnect_button(text = "reconnect", color = "#000")
text |
The text to use on the button. |
class |
The class to apply to the button. |
color |
Color of button. |
A button or link in the form of shiny::tags.
reconnect_button - Returns a button.
reconnect_link - Returns a link.
f7_reconnect_button - A reconnect button for shinyMobile.
Create a button to reload/reconnect to shiny.
reload_button( text = "reload", class = c("default", "danger", "info", "success", "warning"), .class = "" ) reload_link( text = "reload", class = c("default", "danger", "info", "success", "warning"), .class = "" ) f7_reload_button(text = "reload", color = "#000")reload_button( text = "reload", class = c("default", "danger", "info", "success", "warning"), .class = "" ) reload_link( text = "reload", class = c("default", "danger", "info", "success", "warning"), .class = "" ) f7_reload_button(text = "reload", color = "#000")
text |
The text to use on the button. |
class |
The class to apply to the button. |
.class |
Additional class to pass to the link or the button. |
color |
Color of button. |
A button or link in the form of shiny::tags.
reload_button - Returns a button.
reload_link - Returns a link.
f7_reload_button - A reload button for shinyMobile.
Displays a disconnected screen after ms milliseconds of inactivity.
rupture( html = rupture_default(), color = "#fff", opacity = 1, bg_color = "#333e48", bg_image = NULL, ms = 1000 * 60 * 15, session = shiny::getDefaultReactiveDomain(), box = FALSE )rupture( html = rupture_default(), color = "#fff", opacity = 1, bg_color = "#333e48", bg_image = NULL, ms = 1000 * 60 * 15, session = shiny::getDefaultReactiveDomain(), box = FALSE )
html |
Shiny tags to use as content for the disconnected screen,
generally |
opacity |
Opacity of background. |
bg_color, color
|
Background color, color of text. |
bg_image |
Background image to use. |
ms |
Milliseconds before showing the disconnected screen,
defaults to |
session |
A valid shiny session. |
box |
Set to |
None
library(shiny) ui <- fluidPage( useSever(), h1("rupture") ) server <- function(input, output){ rupture( tagList( h1("Whoops"), reconnect_button() ) ) } if(interactive()) shinyApp(ui, server)library(shiny) ui <- fluidPage( useSever(), h1("rupture") ) server <- function(input, output){ rupture( tagList( h1("Whoops"), reconnect_button() ) ) } if(interactive()) shinyApp(ui, server)
The default rupture screen for convenience.
rupture_default( title = "Idle", subtitle = "Your session is disconnected", button = "Reconnect", button_class = "default" )rupture_default( title = "Idle", subtitle = "Your session is disconnected", button = "Reconnect", button_class = "default" )
title |
Title and subtitle to display. |
subtitle |
Title and subtitle to display. |
button |
Text to display on button, passed to |
button_class |
Class of button, passed to |
shiny::tags.
Customise the Shiny disconnected screen.
sever( html = sever_default(), color = "#fff", opacity = 1, bg_color = "#333e48", bg_image = NULL, session = shiny::getDefaultReactiveDomain(), box = FALSE )sever( html = sever_default(), color = "#fff", opacity = 1, bg_color = "#333e48", bg_image = NULL, session = shiny::getDefaultReactiveDomain(), box = FALSE )
html |
Shiny tags to use as content for the disconnected screen,
generally |
opacity |
Opacity of background. |
bg_color, color
|
Background color, color of text. |
bg_image |
Background image to use. |
session |
A valid shiny session. |
box |
Set to |
None
library(shiny) ui <- fluidPage( useSever(), h1("sever") ) server <- function(input, output){ sever( tagList( h1("Whoops"), reload_button() ) ) } if(interactive()) shinyApp(ui, server)library(shiny) ui <- fluidPage( useSever(), h1("sever") ) server <- function(input, output){ sever( tagList( h1("Whoops"), reload_button() ) ) } if(interactive()) shinyApp(ui, server)
The default sever screen for convenience.
sever_default( title = "Whoops!", subtitle = "You have been disconnected", button = "Reload", button_class = "default" )sever_default( title = "Whoops!", subtitle = "You have been disconnected", button = "Reload", button_class = "default" )
title, subtitle
|
Title and subtitle to display. |
button |
Text to display on button, passed to |
button_class |
Class of button, passed to |
shiny::tags.
Checks if uses golem.
uses_golem() runs_golem()uses_golem() runs_golem()