| Title: | Create Dashboards with 'Tabler' |
|---|---|
| Description: | Provides functions to build interactive dashboards using the 'Tabler', making it easy to create professional-looking web applications. 'Tabler' is fully responsive and compatible with all modern browsers. Offers customizable layouts and components built with 'HTML5' and 'CSS3'. The underlying 'Tabler' (<https://github.com/tabler/tabler>) and 'Tabler Icons' (<https://github.com/tabler/tabler-icons>) were pre-built from source to eliminate the need for 'Node.js' and 'NPM' on package installation. |
| Authors: | Mauricio Vargas Sepulveda [aut, cre], Tabler [ctb, cph] (Tabler Dashboard) |
| Maintainer: | Mauricio Vargas Sepulveda <[email protected]> |
| License: | Apache License (>= 2) |
| Version: | 1.4.0 |
| Built: | 2026-07-15 20:44:32 UTC |
| Source: | https://github.com/pachadotdev/tabler |
Serves files under directoryPath at URLs beginning
with /prefix/, mirroring shiny::addResourcePath(). Use this
to serve an app's own CSS/JS/image assets (e.g. from inst/app/www)
without depending on shiny or golem.
addResourcePath(prefix, directoryPath)addResourcePath(prefix, directoryPath)
prefix |
The URL prefix (e.g. |
directoryPath |
Absolute path to the directory to serve. |
Invisibly, NULL.
Wraps content in a Bootstrap column of the given width.
Build a modern card component with optional header, body, and footer
Small helper to render the page pretitle element used by Tabler examples
Small helper to render the page title element used by Tabler examples
Create a standalone page header with optional pretitle and action buttons
Create the full page body structure with optional header
Display a key metric or value prominently
Display an icon from Tabler Icons or other icon libraries
Display important messages to users
Create interactive buttons with Tabler styling
column(width, ..., class = NULL) card(..., title = NULL, footer = NULL, status = NULL, class = NULL) pre_title(text) title(text) header(title, subtitle = NULL, header_actions = NULL) body(..., title = NULL, subtitle = NULL, header_actions = NULL) value_box(value, title, icon = NULL, color = "primary", width = 3) icon(name, library = "tabler", class = NULL) alert(..., type = "info", dismissible = FALSE, title = NULL) button( label, href = NULL, onclick = NULL, color = "primary", size = "md", outline = FALSE, icon = NULL, icon_right = FALSE, disabled = FALSE, block = FALSE, pill = FALSE, square = FALSE, loading = FALSE, class = NULL, type = "button", ... )column(width, ..., class = NULL) card(..., title = NULL, footer = NULL, status = NULL, class = NULL) pre_title(text) title(text) header(title, subtitle = NULL, header_actions = NULL) body(..., title = NULL, subtitle = NULL, header_actions = NULL) value_box(value, title, icon = NULL, color = "primary", width = 3) icon(name, library = "tabler", class = NULL) alert(..., type = "info", dismissible = FALSE, title = NULL) button( label, href = NULL, onclick = NULL, color = "primary", size = "md", outline = FALSE, icon = NULL, icon_right = FALSE, disabled = FALSE, block = FALSE, pill = FALSE, square = FALSE, loading = FALSE, class = NULL, type = "button", ... )
width |
Column width (1-12) |
... |
Additional HTML attributes |
class |
Additional CSS classes |
title |
Alert title (optional) |
footer |
Card footer content (optional) |
status |
Card color status: "primary", "secondary", "success", "warning", "danger", etc. |
text |
The title text to display |
subtitle |
The page pretitle text (optional) |
header_actions |
Additional elements to include in the header (e.g., action buttons) |
value |
Main value to display |
icon |
Icon to include |
color |
Button color theme |
name |
Icon name |
library |
Icon library: "tabler", "bootstrap", "feather" |
type |
HTML button type attribute |
dismissible |
Whether alert can be dismissed |
label |
Button text |
href |
URL to link to (creates an anchor tag instead of button) |
onclick |
JavaScript to execute on click |
size |
Button size: "sm", "md", "lg" |
outline |
Use outline style |
icon_right |
Position icon on the right side |
disabled |
Whether the button is disabled |
block |
Make button full-width (block-level) |
pill |
Use pill-shaped button style |
square |
Use square button style |
loading |
Show loading spinner |
An HTML tag.
An HTML tag representing the card
An HTML tag representing the value box
An HTML tag representing the icon
An HTML tag representing the alert
An HTML tag representing the button
Returns the session object of the tablerApp
server function currently executing, or NULL if none is running.
Used as the default session argument of moduleServer.
getDefaultReactiveDomain()getDefaultReactiveDomain()
A tablerApp session object, or NULL.
Mark a String as Raw HTML (Do Not Escape)
HTML(text)HTML(text)
text |
Character string of literal HTML. |
An object of class "tabler.html".
Convenience functions for building common HTML elements. Each function
accepts child content and named attributes as ... arguments and
returns a tabler.tag object that can be nested, rendered with
as.character(), or passed to any tabler layout function.
div(...) span(...) p(...) a(...) img(...) ul(...) li(...) aside(...) h1(...) h2(...) h3(...) h4(...) h5(...) h6(...) br(...)div(...) span(...) p(...) a(...) img(...) ul(...) li(...) aside(...) h1(...) h2(...) h3(...) h4(...) h5(...) h6(...) br(...)
... |
Child elements (strings, other tags) and/or named HTML
attributes (e.g. |
A tabler.tag object.
tags for the full HTML5 tag namespace.
A dataset containing Tabler icon names and their categories.
iconsicons
A data frame with 6,019 rows and 3 variables:
The root category of the icon (e.g., "arrow/arrows", "brand", "device", etc.)
The full icon name (e.g., "arrow-up", "arrow-down", "circle-arrow-up", "circle-arrow-up-filled", etc.)
Logical indicating whether the icon is a filled or not.
Derived from the icons from https://github.com/tabler/tabler-icons
icons[grepl("paw", icons$icon), ]icons[grepl("paw", icons$icon), ]
Dependency-free equivalent of shiny::moduleServer().
Wraps input/output so that unprefixed names accessed
inside module are automatically namespaced with id,
matching the ids produced by NS(id) in the module's UI function.
moduleServer(id, module, session = getDefaultReactiveDomain())moduleServer(id, module, session = getDefaultReactiveDomain())
id |
The module's namespace id (must match the id used to call the
module's |
module |
A function with signature |
session |
The parent session object. Defaults to the currently
running |
The return value of module, invisibly.
Prefixes an id with a namespace, mirroring the id-prefixing
behaviour of shiny::NS() without depending on shiny or its
module system.
NS(namespace, id = NULL)NS(namespace, id = NULL)
namespace |
Namespace prefix. |
id |
Id to namespace. If missing, returns a function that namespaces
any id it is given (as |
If id is given, a namespaced id (character string).
Otherwise, a function that namespaces any id passed to it.
ns <- NS("mymodule") ns("button") # "mymodule-button" NS("mymodule", "button") # "mymodule-button"ns <- NS("mymodule") ns("button") # "mymodule-button" NS("mymodule", "button") # "mymodule-button"
Main function to create a complete dashboard page with Tabler theme
Helper to create a top navigation header. This replaces the previous top-navbar behavior when users passed a header-like component.
Footer for the dashboard
Container for navigation items in sidebar
Container for navigation items in horizontal layout
Individual navigation item for sidebar
Container for multiple tab panels in tabbed layouts
Individual tab panel content
page( title = NULL, navbar = NULL, body = NULL, footer = NULL, layout = "boxed", theme = "light", color = "blue", show_theme_button = FALSE ) topbar(title = NULL, brand_image = NULL, ...) footer(left = NULL, right = NULL) sidebar_menu(..., title = NULL) horizontal_menu(...) menu_item(text, tab_name = NULL, icon = NULL, href = NULL, badge = NULL) tab_items(...) tab_item(tab_name, ...)page( title = NULL, navbar = NULL, body = NULL, footer = NULL, layout = "boxed", theme = "light", color = "blue", show_theme_button = FALSE ) topbar(title = NULL, brand_image = NULL, ...) footer(left = NULL, right = NULL) sidebar_menu(..., title = NULL) horizontal_menu(...) menu_item(text, tab_name = NULL, icon = NULL, href = NULL, badge = NULL) tab_items(...) tab_item(tab_name, ...)
title |
Optional brand for the sidebar; either a string (text title) or a named list with elements 'text' and 'img' (URL/path) to render a brand image and title. Example: 'title = list(text = "My App", img = "logo.png")'. |
navbar |
Dashboard navbar/menu. Can be: - 'sidebar_menu()' for a vertical sidebar - 'horizontal_menu()' for a horizontal menu |
body |
Dashboard body content |
footer |
Dashboard footer (optional) |
layout |
Layout type: "boxed" (default), "combo", "condensed", "fluid", "fluid-vertical", "horizontal", "navbar", "navbar-dark", "navbar-overlap", "navbar-sticky", "navbar-sticky-dark", "rtl", "vertical", "vertical-right", "vertical-transparent" |
theme |
Default theme: "light" (default) or "dark". |
color |
Color theme (optional): "blue" (default), "azure", "indigo", "purple", "pink", "red", "orange", "yellow", "lime", "green", "teal", "cyan". |
show_theme_button |
Whether to show the theme toggle buttons (default: 'FALSE'). |
brand_image |
URL or path to brand image |
... |
Content for this tab |
left |
Left-aligned content |
right |
Right-aligned content |
text |
Item text/label |
tab_name |
Unique identifier for the tab (must match menuItem tab_name) |
icon |
Icon name (optional) |
href |
Link URL (optional, alternative to tab_name) |
badge |
Badge text (optional) |
HTML tag with dependencies attached
An HTML tag representing the top header
An HTML tag representing the footer
An HTML tag representing the sidebar menu
An HTML tag representing the horizontal menu
An HTML tag representing the menu item
An HTML tag representing the tab items container
An HTML tag representing the tab item
ui <- page( title = "Combo Dashboard", layout = "combo", navbar = list( top = topbar(title = "My App"), side = sidebar_menu( menu_item("Dogs", icon = "dog"), menu_item("Cats", icon = "cat") ) ), body = body("Welcome to Tabler!") ) server <- function(input, output, session) {} # tablerApp(ui, server)ui <- page( title = "Combo Dashboard", layout = "combo", navbar = list( top = topbar(title = "My App"), side = sidebar_menu( menu_item("Dogs", icon = "dog"), menu_item("Cats", icon = "cat") ) ), body = body("Welcome to Tabler!") ) server <- function(input, output, session) {} # tablerApp(ui, server)
A single mutable reactive value. Call with no argument to read (tracks the caller as a dependent); call with one argument to write (invalidates all current dependents).
A named collection of reactive values similar to a reactive list.
Access with rv$name (reactive read) or rv$name <- val (reactive write).
Returns a plain list snapshot of a reactiveValues
object's current values, establishing a reactive read dependency on each
contained value, similar to shiny::reactiveValuesToList().
A lazy, cached computation that re-evaluates only when its reactive dependencies are invalidated.
Stops execution of the current reactive expression, observer,
or render function if any argument is not "truthy" (i.e. is NULL,
NA, FALSE, an empty string, or an empty vector), similar to
shiny::req(). Unlike a normal error, this stop is silent: an
observe()/observeEvent() block simply does nothing for this
run, and a render function (renderUI, renderText, ...)
simply leaves its output unchanged, instead of showing an error.
Any reactive reads inside expr are not registered as
dependencies of the current context.
Eagerly re-runs expr whenever its reactive dependencies
change.
Runs handlerExpr whenever eventExpr changes.
A reactive expression that recomputes valueExpr only
when eventExpr changes, similar to shiny::eventReactive().
Modifies a reactive expression created by reactive
so that it only (re)executes when the given event expression(s) change,
similar to shiny::bindEvent(). Typically used with the pipe:
reactive({...}) |> bindEvent(input$go).
Configure package-wide options for tabler. Currently this
only sets the cache backend used by bindCache, mirroring
shiny::shinyOptions(cache = ...).
Persistently caches a reactive expression's value, keyed by
one or more key expressions, similar to shiny::bindCache().
Unlike reactive's built-in caching (in-memory, lost as
soon as its dependencies change), bindCache() stores values in
the cache backend configured via tablerOptions (e.g.
cachem::cache_disk()), so identical key combinations are served
instantly - even across app restarts or different sessions - without
re-running x. Typically used with the pipe:
reactive({...}) |> bindCache(key1, key2) |> bindEvent(input$go).
Call once inside the server function to enable two-way URL parameter synchronisation: the URL query string initialises inputs on page load, and every subsequent input change updates the URL in-place (no page reload, no browser-history spam).
reactiveVal(value = NULL) reactiveValues(...) reactiveValuesToList(x, all.names = FALSE) reactive(expr) req(..., cancelOutput = FALSE) isolate(expr) observe(expr) observeEvent(eventExpr, handlerExpr, ignoreInit = TRUE) eventReactive(eventExpr, valueExpr, ignoreNULL = TRUE, ignoreInit = TRUE) bindEvent(x, ..., ignoreNULL = TRUE, ignoreInit = TRUE) tablerOptions(cache) bindCache(x, ...) syncUrl(session, exclude = character(0L))reactiveVal(value = NULL) reactiveValues(...) reactiveValuesToList(x, all.names = FALSE) reactive(expr) req(..., cancelOutput = FALSE) isolate(expr) observe(expr) observeEvent(eventExpr, handlerExpr, ignoreInit = TRUE) eventReactive(eventExpr, valueExpr, ignoreNULL = TRUE, ignoreInit = TRUE) bindEvent(x, ..., ignoreNULL = TRUE, ignoreInit = TRUE) tablerOptions(cache) bindCache(x, ...) syncUrl(session, exclude = character(0L))
value |
Initial value. |
... |
One or more (unevaluated) key expressions. Whenever their
combined value changes, |
x |
A reactive expression created by |
all.names |
Include names starting with a dot (default |
expr |
Expression with side effects. |
cancelOutput |
Ignored (kept for signature compatibility with Shiny). |
eventExpr |
Reactive expression whose change triggers re-evaluation. |
handlerExpr |
Expression to run when the event fires. |
ignoreInit |
If |
valueExpr |
Expression to evaluate (and cache) when the event fires. |
ignoreNULL |
If |
cache |
A cachem cache object (e.g. |
session |
The |
exclude |
Character vector of input IDs to omit from the URL. Action buttons are always omitted regardless of this setting. |
The resulting URL is clean and quote-free, e.g.
http://localhost:3000/?dataset=mtcars&n_rows=10&stat=mean
Sharing or bookmarking that URL restores the exact input state.
A function that acts as getter/setter.
An environment of class "ReactiveValues".
A named list.
A zero-argument function returning the cached value.
The last argument, invisibly, if all checks pass.
The result of expr.
An invisible observer handle with $suspend() / $resume().
A zero-argument function returning the cached value.
A new zero-argument function returning the cached value.
Invisibly, the previous options (as a named list, for restoring later).
A new zero-argument function returning the (possibly cached) value.
Invisibly, session (for chaining).
A dropdown that lets the user pick one item from a list.
A horizontal range slider. When value has length 2,
two thumbs are rendered (a "from"/"to" range slider) and the server
receives a length-2 numeric vector, e.g. c(2018, 2022).
Change the choices and/or selected value of a
selectInput already displayed in the browser, without a
full page reload, similar to shiny::updateSelectInput().
Change the value/min/max/step of a sliderInput
already displayed in the browser, similar to
shiny::updateSliderInput().
A single-line text field.
A numeric input field.
A boolean on/off checkbox.
A clickable button. Its value in input is an integer that
increments by one on each click (starts at 0).
A set of checkboxes for selecting multiple values.
A group of mutually-exclusive radio buttons.
selectInput(inputId, label, choices, selected = NULL, ...) sliderInput(inputId, label, min, max, value, step = 1, ...) updateSelectInput( session, inputId, label = NULL, choices = NULL, selected = NULL, ... ) updateSelectizeInput( session, inputId, label = NULL, choices = NULL, selected = NULL, ... ) updateSliderInput( session, inputId, label = NULL, value = NULL, min = NULL, max = NULL, step = NULL ) textInput(inputId, label, value = "", placeholder = NULL, ...) numericInput(inputId, label, value, min = NULL, max = NULL, step = 1, ...) checkboxInput(inputId, label, value = FALSE, ...) actionButton(inputId, label, class = "btn-primary", icon = NULL, ...) checkboxGroupInput(inputId, label, choices, selected = NULL) radioButtons(inputId, label, choices, selected = NULL)selectInput(inputId, label, choices, selected = NULL, ...) sliderInput(inputId, label, min, max, value, step = 1, ...) updateSelectInput( session, inputId, label = NULL, choices = NULL, selected = NULL, ... ) updateSelectizeInput( session, inputId, label = NULL, choices = NULL, selected = NULL, ... ) updateSliderInput( session, inputId, label = NULL, value = NULL, min = NULL, max = NULL, step = NULL ) textInput(inputId, label, value = "", placeholder = NULL, ...) numericInput(inputId, label, value, min = NULL, max = NULL, step = 1, ...) checkboxInput(inputId, label, value = FALSE, ...) actionButton(inputId, label, class = "btn-primary", icon = NULL, ...) checkboxGroupInput(inputId, label, choices, selected = NULL) radioButtons(inputId, label, choices, selected = NULL)
inputId |
The input identifier. |
label |
Display label. |
choices |
Named or unnamed character vector of choices. |
selected |
Initially-selected value (defaults to first choice). |
... |
Additional HTML attributes. |
min |
Minimum (optional). |
max |
Maximum (optional). |
value |
Initial checked state ( |
step |
Step size (default |
session |
The session object. |
placeholder |
Placeholder text. |
class |
Additional CSS classes (default |
icon |
Optional icon name to prepend. |
An HTML tag.
An HTML tag.
Invisibly, NULL.
Invisibly, NULL.
An HTML tag.
An HTML tag.
An HTML tag.
An HTML tag.
An HTML tag.
An HTML tag.
Displays (or hides) a full-page loading overlay with an animated progress
bar in a running tablerApp. Useful for indicating that a
long-running computation (e.g. a database query) is in progress.
showProgress(session = getDefaultReactiveDomain(), text = "Loading...") hideProgress(session = getDefaultReactiveDomain())showProgress(session = getDefaultReactiveDomain(), text = "Loading...") hideProgress(session = getDefaultReactiveDomain())
session |
The |
text |
The message displayed above the progress bar. |
This is a dependency-free replacement for ad-hoc waiter/custom
JS overlay setups. It works the same way as
show/hide: the server sends a small message
over the WebSocket connection and the browser-side JS
(tabler-progress.js) creates/reveals or hides the overlay.
tablerApp's event loop only writes queued WebSocket messages
to the socket in between iterations of its
repeat { httpuv::service(); ... } loop. If showProgress()
is immediately followed by a long, blocking computation in the same
observer, the "show" message sits in the queue - never reaching the
browser - until that observer (and thus the slow computation) finishes,
making the overlay flash on right at the end instead of before the work
starts. Calling httpuv::service() again from inside the observer to
force an early flush is unsafe here: it re-enters httpuv's event
loop while it is still dispatching the current WebSocket message, which
can cause that message (and the input it carries) to be processed more
than once. Use withProgress instead, which defers the slow
computation with later::later() so control returns to the event
loop (flushing the "show" message) before the work actually runs.
Invisibly, NULL.
if (interactive()) { ui <- page( title = "Progress Example", body = body(actionButton("btn", "Load data")) ) server <- function(input, output, session) { observeEvent(input$btn, { withProgress(session, "Loading data...", { Sys.sleep(2) }) }) } tablerApp(ui, server) }if (interactive()) { ui <- page( title = "Progress Example", body = body(actionButton("btn", "Load data")) ) server <- function(input, output, session) { observeEvent(input$btn, { withProgress(session, "Loading data...", { Sys.sleep(2) }) }) } tablerApp(ui, server) }
Helper to build a brand structure for 'sidebar_menu(title = ...)'.
sidebar_brand(text = NULL, img = NULL, href = "#")sidebar_brand(text = NULL, img = NULL, href = "#")
text |
Brand text/label |
img |
Optional image URL/path for brand logo |
href |
Optional link URL for the brand (defaults to "#") |
A named list suitable to pass to 'sidebar_menu(title = )'
sidebar_brand("My App", img = "logo.png")sidebar_brand("My App", img = "logo.png")
Launches a self-contained web application using httpuv for HTTP and WebSocket transport.
tablerApp( ui, server, host = "127.0.0.1", port = 3000L, launch.browser = interactive() )tablerApp( ui, server, host = "127.0.0.1", port = 3000L, launch.browser = interactive() )
ui |
The UI definition — typically a call to |
server |
A function with signature |
host |
Host to listen on (default |
port |
Port number (default |
launch.browser |
Open a browser automatically when in an interactive session. |
Protocol
The browser and server exchange plain JSON messages over a WebSocket at
/ws:
Browser → R: {"type":"input","name":"<id>","value":<v>}
R → Browser: {"type":"output","id":"<id>","html":"<escaped HTML>"}
Reactive system
Uses tabler's own dependency-tracking reactive system (see reactive,
observe, reactiveVal, observeEvent).
Render functions (renderText, renderUI, renderPrint) are
assigned to output inside server.
Invisibly, after the server is stopped.
Append Attributes to an Existing Tag
tagAppendAttributes(tag, ...)tagAppendAttributes(tag, ...)
tag |
A tabler.tag object. |
... |
Named attributes to add/overwrite. The |
The modified tag.
Create an Ordered Collection of Tags
tagList(...)tagList(...)
... |
Tags or other HTML content. |
A tabler.tag.list object.
A named list of tag-builder functions covering the full HTML5
element set. Usage: tags$section(class = "foo", "content").
tagstags
Places a <span> in the UI whose content is updated by
renderText in the server.
Places a <pre> in the UI for monospace/printed output.
Places a tag (by default a <div>) whose inner HTML is
replaced wholesale by renderUI output.
Returns a character string that is HTML-escaped and injected as
the inner HTML of the matching textOutput placeholder.
Captures the print() representation of the result and
shows it verbatim (HTML-escaped).
Returns an HTML tag tree that replaces the inner HTML of the
matching uiOutput placeholder.
Places a <div> in the UI whose content is replaced by a
base-R plot rendered server-side via renderPlot.
Evaluates expr inside an SVG graphics device, and
injects the resulting inline SVG into the matching plotOutput
placeholder. Works with base-R graphics, tinyplot, ggplot2,
lattice, and any other graphics system that honours the active
device.
Places a <div> in the UI whose content is replaced by an
htmlwidget (e.g. from d3po, leaflet, plotly) rendered by
a matching server-side call. The widget is served inside a sandboxed
<iframe> so its own JS/CSS cannot conflict with the page.
Generic render function for any htmlwidgets-based widget.
Captures the expression without evaluating it and stores the calling
environment, so tablerApp can evaluate it inside a reactive context
without requiring a live Shiny session. Reactive values referenced inside
expr are tracked automatically.
Assigned to output$id, serves a file for download when
the browser requests the matching downloadButton's link,
similar to shiny::downloadHandler(). Unlike other outputs, the
file is generated fresh (not cached/pushed) each time it is requested.
Creates a link that triggers a file download from the
matching downloadHandler, similar to
shiny::downloadButton()/shiny::downloadLink().
textOutput(outputId, inline = FALSE) verbatimTextOutput(outputId) uiOutput(outputId, container = div, ...) htmlOutput(outputId, container = div, ...) renderText(expr) renderPrint(expr) renderUI(expr) plotOutput(outputId, width = "100%", height = "400px") renderPlot(expr, width = 800, height = 400) widgetOutput(outputId, width = "100%", height = "400px") renderWidget(expr) downloadHandler(filename, content, contentType = NULL) downloadButton( outputId, label = "Download", class = "btn-primary", icon = "download", ... ) downloadLink(outputId, label = "Download", class = NULL, icon = NULL, ...)textOutput(outputId, inline = FALSE) verbatimTextOutput(outputId) uiOutput(outputId, container = div, ...) htmlOutput(outputId, container = div, ...) renderText(expr) renderPrint(expr) renderUI(expr) plotOutput(outputId, width = "100%", height = "400px") renderPlot(expr, width = 800, height = 400) widgetOutput(outputId, width = "100%", height = "400px") renderWidget(expr) downloadHandler(filename, content, contentType = NULL) downloadButton( outputId, label = "Download", class = "btn-primary", icon = "download", ... ) downloadLink(outputId, label = "Download", class = NULL, icon = NULL, ...)
outputId |
The output identifier (must match the server-side
|
inline |
If |
container |
A tag-building function used to create the placeholder
element, e.g. |
... |
Additional HTML attributes. |
expr |
Expression that returns an |
width |
CSS width string (default |
height |
CSS height string (default |
filename |
A string, or a zero-argument function returning a string,
giving the filename offered to the browser (e.g. |
content |
A one-argument function |
contentType |
Optional MIME type string. If |
label |
Link/button text. |
class |
Additional CSS classes (default |
icon |
Optional icon name to prepend. |
Package authors who ship their own render_*() helpers can make them
tabler-compatible by attaching the same two attributes:
attr(fn, "tabler_expr") <- substitute(expr) attr(fn, "tabler_env") <- parent.frame()
This is exactly what render_d3po() in d3po already does.
An HTML tag.
An HTML tag.
An HTML tag.
A tabler_render object for use with tablerApp.
A tabler_render object.
A tabler_render object.
An HTML tag.
A tabler_render object.
An HTML tag.
A zero-argument function with tabler_expr and
tabler_env attributes recognised by tablerApp.
A tabler_render object for use with tablerApp.
An HTML tag.
Show or hide an HTML element in a running tablerApp.show makes an element visible, hide makes
an element invisible, toggle displays the element if it is
hidden and hides it if it is visible.showElement, hideElement, and
toggleElement are synonyms for show/hide/
toggle.
If condition is given to toggle, that condition is used to
decide whether to show or hide the element: the element is shown when the
condition evaluates to TRUE and hidden otherwise.
show( session = getDefaultReactiveDomain(), id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL ) showElement( session = getDefaultReactiveDomain(), id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL ) hide( session = getDefaultReactiveDomain(), id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL ) hideElement( session = getDefaultReactiveDomain(), id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL ) toggle( session = getDefaultReactiveDomain(), id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL, condition = NULL ) toggleElement( session = getDefaultReactiveDomain(), id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL, condition = NULL )show( session = getDefaultReactiveDomain(), id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL ) showElement( session = getDefaultReactiveDomain(), id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL ) hide( session = getDefaultReactiveDomain(), id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL ) hideElement( session = getDefaultReactiveDomain(), id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL ) toggle( session = getDefaultReactiveDomain(), id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL, condition = NULL ) toggleElement( session = getDefaultReactiveDomain(), id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL, condition = NULL )
session |
The |
id |
The id of the element/HTML tag. |
anim |
If |
animType |
The type of animation to use, either |
time |
The number of seconds to make the animation last. |
selector |
CSS selector of the elements to show/hide. Ignored if the
|
condition |
An optional argument to |
This is a dependency-free adaptation of shinyjs's
show/hide/toggle functions for tabler, which does
not use or depend on shiny. Instead of relying on a Shiny session,
these functions use the plain-list session object created by
tablerApp and passed as the third argument to the
server function.
if (interactive()) { ui <- page( title = "Show/Hide Example", body = body( actionButton("btn", "Click me"), div(id = "panel", "Watch what happens to me") ) ) server <- function(input, output, session) { observeEvent(input$btn, { # Change the following line for more examples toggle(session, "panel") }) } tablerApp(ui, server) } ## Not run: # The function call in the above app can be replaced by any of the # following examples to produce similar apps toggle(session, id = "panel") toggle(session, "panel", TRUE) toggle(session, "panel", TRUE, "fade", 2) toggle(session, id = "panel", time = 1, anim = TRUE, animType = "slide") show(session, "panel") show(session, id = "panel", anim = TRUE) hide(session, "panel") hide(session, id = "panel", anim = TRUE) ## End(Not run) ## toggle can be given an optional `condition` argument, which ## determines if to show or hide the element if (interactive()) { ui <- page( title = "Conditional Toggle", body = body( checkboxInput("checkbox", "Show the text", TRUE), div(id = "element", "Watch what happens to me") ) ) server <- function(input, output, session) { observe({ toggle(session, id = "element", condition = input$checkbox) }) } tablerApp(ui, server) }if (interactive()) { ui <- page( title = "Show/Hide Example", body = body( actionButton("btn", "Click me"), div(id = "panel", "Watch what happens to me") ) ) server <- function(input, output, session) { observeEvent(input$btn, { # Change the following line for more examples toggle(session, "panel") }) } tablerApp(ui, server) } ## Not run: # The function call in the above app can be replaced by any of the # following examples to produce similar apps toggle(session, id = "panel") toggle(session, "panel", TRUE) toggle(session, "panel", TRUE, "fade", 2) toggle(session, id = "panel", time = 1, anim = TRUE, animType = "slide") show(session, "panel") show(session, id = "panel", anim = TRUE) hide(session, "panel") hide(session, id = "panel", anim = TRUE) ## End(Not run) ## toggle can be given an optional `condition` argument, which ## determines if to show or hide the element if (interactive()) { ui <- page( title = "Conditional Toggle", body = body( checkboxInput("checkbox", "Show the text", TRUE), div(id = "element", "Watch what happens to me") ) ) server <- function(input, output, session) { observe({ toggle(session, id = "element", condition = input$checkbox) }) } tablerApp(ui, server) }
Shows the full-page progress overlay (see showProgress),
then runs expr, then hides the overlay again - but unlike calling
showProgress/hideProgress directly around a
blocking computation, expr is deferred with later::later()
so that tablerApp's event loop gets a chance to actually
flush the "show" message to the browser before the slow work begins.
withProgress(session = getDefaultReactiveDomain(), text = "Loading...", expr)withProgress(session = getDefaultReactiveDomain(), text = "Loading...", expr)
session |
The |
text |
The message displayed above the progress bar. |
expr |
The (potentially slow) expression to run once the overlay is visible. |
Invisibly, NULL. expr runs asynchronously, after
withProgress() itself has already returned.
if (interactive()) { ui <- page( title = "Progress Example", body = body(actionButton("btn", "Load data")) ) server <- function(input, output, session) { observeEvent(input$btn, { withProgress(session, "Loading data...", { Sys.sleep(2) }) }) } tablerApp(ui, server) }if (interactive()) { ui <- page( title = "Progress Example", body = body(actionButton("btn", "Load data")) ) server <- function(input, output, session) { observeEvent(input$btn, { withProgress(session, "Loading data...", { Sys.sleep(2) }) }) } tablerApp(ui, server) }