| Title: | 'Element Plus' Components for 'shiny' |
|---|---|
| Description: | 'Element Plus' ('Vue' 3) components for 'shiny': forms, tables, trees, menus, dialog boxes and the rest, each reporting to the server and updated from it like any other 'shiny' input. 'Element Plus' and 'Vue' are bundled, so applications work offline. |
| Authors: | Kaiping Yang [aut, cre], Element Plus team [ctb, cph] (Element Plus and its icons, bundled in inst/element-plus, MIT licence), Evan You [ctb, cph] (Vue library bundled in inst/vue3, MIT licence) |
| Maintainer: | Kaiping Yang <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.3.1 |
| Built: | 2026-11-04 22:09:24 UTC |
| Source: | https://github.com/kaipingyang/shiny.element |
update_el_table() and the other update_el_*() functions assign into the
Vue instance's data, which reaches a component's props. Element also
documents methods – clearSelection(), setCheckedKeys(),
validate() – which are functions on the component and cannot be reached
that way. call_el() invokes one: it is call_vue() with Element's
references to table rows, upload files and tree nodes.
call_el( session = shiny::getDefaultReactiveDomain(), id, method, args = list(), result = TRUE, component = NULL )call_el( session = shiny::getDefaultReactiveDomain(), id, method, args = list(), result = TRUE, component = NULL )
session |
Shiny session; the current one by default, as for
|
id |
Component ID (un-namespaced). |
method |
Name of the Element method to call. |
args |
A list of arguments, passed positionally. A row of a table
or a file of an upload is given by |
result |
Whether to report the return value as an input. Default
|
component |
Optional Element component name ( |
A method that returns something reports it as input$<id>_<method>, with
the method name in snake_case, matching how events are reported:
getCheckedKeys arrives as input$<id>_get_checked_keys. The input is set
with event priority, so asking twice and getting the same answer still
fires an observeEvent() the second time.
A method that returns nothing reports TRUE, so an observeEvent() can
still tell that it ran. Pass result = FALSE to send nothing back.
Each component's methods are listed in its own help page, under "Element methods".
Called for its side effect; returns NULL invisibly.
if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_tree( "tree", show_checkbox = TRUE, node_key = "id", checked = "apple", default_expand_all = TRUE, data = list(list( id = "fruit", label = "Fruit", children = list( list(id = "apple", label = "Apple"), list(id = "pear", label = "Pear") ) )) ), el_button("clear", "Clear the ticks"), el_button("ask", "Which are ticked?"), verbatimTextOutput("answer") ) server <- function(input, output, session) { # A command: setCheckedKeys() with an empty set observeEvent(input$clear, { call_el(session, "tree", "setCheckedKeys", list(list())) }) # A method with a return value answers asynchronously observeEvent(input$ask, { call_el(session, "tree", "getCheckedKeys") }) output$answer <- renderPrint(input$tree_get_checked_keys) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_tree( "tree", show_checkbox = TRUE, node_key = "id", checked = "apple", default_expand_all = TRUE, data = list(list( id = "fruit", label = "Fruit", children = list( list(id = "apple", label = "Apple"), list(id = "pear", label = "Pear") ) )) ), el_button("clear", "Clear the ticks"), el_button("ask", "Which are ticked?"), verbatimTextOutput("answer") ) server <- function(input, output, session) { # A command: setCheckedKeys() with an empty set observeEvent(input$clear, { call_el(session, "tree", "setCheckedKeys", list(list())) }) # A method with a return value answers asynchronously observeEvent(input$ask, { call_el(session, "tree", "getCheckedKeys") }) output$answer <- renderPrint(input$tree_get_checked_keys) } shinyApp(ui, server) }
update_vue() assigns data; a method is a function, reached with this.
The method is looked up on the component the template renders – a
library table's clearSelection(), a child component's own – or, with
component, on the first component of that name under the id.
call_vue( session = shiny::getDefaultReactiveDomain(), id, method, args = list(), result = TRUE, component = NULL )call_vue( session = shiny::getDefaultReactiveDomain(), id, method, args = list(), result = TRUE, component = NULL )
session |
Shiny session; the current one by default, as for
|
id |
The component's id (un-namespaced). |
method |
The method's name. |
args |
A list of arguments, passed in order. |
result |
Whether to report the return value. Default |
component |
Name of the component to look for under |
A method that returns something reports it as input$<id>_<method>,
the method name in snake_case; one that returns nothing reports TRUE.
The input has event priority, so the same answer twice still fires an
observeEvent(). A promise reports what it resolves to.
Called for its side effect; returns NULL invisibly.
if (interactive()) { # inside a server function observeEvent(input$reset, call_vue(id = "form", method = "resetFields")) }if (interactive()) { # inside a server function observeEvent(input$reset, call_vue(id = "form", method = "resetFields")) }
Convert a data.frame with custom value/label columns to Element-UI Cascader options list
df_to_cascader_options(df, value_cols, label_cols = NULL)df_to_cascader_options(df, value_cols, label_cols = NULL)
df |
Data frame with hierarchical columns |
value_cols |
Character vector of value column names (e.g. c("value1", "value2", ...)) |
label_cols |
Character vector of label column names (e.g. c("label1", "label2", ...)), can be NULL or contain NA for levels without label |
Nested list for cascader options
df <- data.frame( province = c("Zhejiang", "Zhejiang", "Jiangsu"), city = c("Hangzhou", "Ningbo", "Nanjing"), stringsAsFactors = FALSE ) df_to_cascader_options(df, c("province", "city")) # Separate value and label columns df$province_label <- paste(df$province, "Province") df_to_cascader_options(df, c("province", "city"), c("province_label", NA))df <- data.frame( province = c("Zhejiang", "Zhejiang", "Jiangsu"), city = c("Hangzhou", "Ningbo", "Nanjing"), stringsAsFactors = FALSE ) df_to_cascader_options(df, c("province", "city")) # Separate value and label columns df$province_label <- paste(df$province, "Province") df_to_cascader_options(df, c("province", "city"), c("province_label", NA))
Turns hierarchical columns into the nested node lists el_tree() expects,
one level per column. Keys are built by joining a row's values down to that
level, so a label repeated under different parents still gets a unique key.
df_to_tree_data(df, cols, sep = "/")df_to_tree_data(df, cols, sep = "/")
df |
A data frame. |
cols |
Column names, outermost level first. |
sep |
Separator used when joining values into a key. |
A list of nodes.
df <- data.frame( region = c("North", "North", "South"), city = c("Leeds", "York", "Bath"), stringsAsFactors = FALSE ) df_to_tree_data(df, c("region", "city"))df <- data.frame( region = c("North", "North", "South"), city = c("Leeds", "York", "Bath"), stringsAsFactors = FALSE ) df_to_tree_data(df, c("region", "city"))
A tag generator for every Element tag, as tags$p is for HTML:
el$button(type = "primary", "Go") writes <el-button type="primary">.
Nothing more – no Vue instance, no Shiny input, no id.
elel
An <el-*> tag becomes an Element component only when a Vue instance
compiles it, so these belong where one already does:
the markup of el_widget(), when building a component of your own;
a template() or a component's slots;
a table column's cell in el_table();
the trigger of a wrapper – el_tooltip(), el_popover(),
el_popconfirm().
Anywhere else – the top level of a page, or inside the markup-only
containers (el_tabs(), el_collapse(), el_dialog(), el_drawer(),
el_row(), el_container()) – nothing compiles them and they show as
bare text; the browser console says so. There, use the component
functions: el_button(), el_tag() and the rest.
A logical attribute is a Vue boolean: el$button(link = TRUE) writes
<el-button link> and plain = FALSE writes :plain="false" – as text,
link="TRUE", Element Plus would refuse it.
Mounting a Vue instance over such markup automatically is deliberately not done: it would rebuild every component and Shiny input inside it, leaving them on screen but disconnected from the server.
A named list of tag-generating functions, one per Element Plus tag.
names(el) # As a wrapper's trigger, compiled by the tooltip's own instance el_tooltip("hint", el$button(type = "primary", "Hover me"), content = "Help") # In a table cell, once per row el_table( "tasks", data = data.frame(task = c("Draft", "Review"), done = c(TRUE, FALSE)), columns = list( list(prop = "task", label = "Task"), list( label = "State", cell = el$tag( ":type" = "scope.row.done ? 'success' : 'info'", "{{ scope.row.done ? 'done' : 'open' }}" ) ) ) ) # As the markup of a component of your own el_widget( "me", markup = el$avatar(":size" = "size", "{{ initials }}"), data = list(size = 48, initials = "KY") )names(el) # As a wrapper's trigger, compiled by the tooltip's own instance el_tooltip("hint", el$button(type = "primary", "Hover me"), content = "Help") # In a table cell, once per row el_table( "tasks", data = data.frame(task = c("Draft", "Review"), done = c(TRUE, FALSE)), columns = list( list(prop = "task", label = "Task"), list( label = "State", cell = el$tag( ":type" = "scope.row.done ? 'success' : 'info'", "{{ scope.row.done ? 'done' : 'open' }}" ) ) ) ) # As the markup of a component of your own el_widget( "me", markup = el$avatar(":size" = "size", "{{ initials }}"), data = list(size = 48, initials = "KY") )
Content that stays fixed to the top or bottom of the viewport once scrolled to it.
el_affix( ..., id = NULL, offset = NULL, position = NULL, target = NULL, z_index = NULL, teleported = NULL, append_to = NULL, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_affix( session = shiny::getDefaultReactiveDomain(), id, offset = NULL, position = NULL, z_index = NULL, target = NULL, teleported = NULL, append_to = NULL )el_affix( ..., id = NULL, offset = NULL, position = NULL, target = NULL, z_index = NULL, teleported = NULL, append_to = NULL, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_affix( session = shiny::getDefaultReactiveDomain(), id, offset = NULL, position = NULL, z_index = NULL, target = NULL, teleported = NULL, append_to = NULL )
... |
Its content: any Shiny UI. Components of this package are folded
into this one's Vue instance, as |
id |
Component ID. Auto-generated if |
offset |
Offset distance. Element Plus's |
position |
Position of affix. Element Plus's |
target |
Target container (CSS selector). Element Plus's |
z_index |
|
teleported |
Whether affix element is teleported, if |
append_to |
Which element the affix element appends to. Element Plus's
|
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents. A scoped slot is written
with |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id>_change |
unasked | triggers when fixed state changed |
input$<id>_scroll |
events = "scroll" |
list(scrollTop, fixed), at most every 200 ms
|
The same list as el_events("el_affix"), which says how an event's arguments travel.
Callable with call_el(): update(), updateRoot().
update_el_affix() changes the component from the server: every argument of
el_affix() that can change once it is drawn, under the same name. One left
NULL stays as it is; NA returns it to Element's default.
update_el_affix() is called for its side effect and returns NULL invisibly.
el_affix(el_button("top", "Stays on top"), offset = 120)el_affix(el_button("top", "Stays on top"), offset = 120)
An inline alert banner with optional close button. Fires a Shiny input when the user closes it.
el_alert( id = NULL, title = "", description = NULL, type = "info", closable = TRUE, close_text = "", show_icon = FALSE, center = FALSE, effect = "light", width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_alert( session = shiny::getDefaultReactiveDomain(), id, title = NULL, type = NULL, description = NULL, closable = NULL, close_text = NULL, show_icon = NULL, center = NULL, effect = NULL )el_alert( id = NULL, title = "", description = NULL, type = "info", closable = TRUE, close_text = "", show_icon = FALSE, center = FALSE, effect = "light", width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_alert( session = shiny::getDefaultReactiveDomain(), id, title = NULL, type = NULL, description = NULL, closable = NULL, close_text = NULL, show_icon = NULL, center = NULL, effect = NULL )
id |
Alert ID. Auto-generated UUID if |
title |
Main alert title text. |
description |
Optional secondary description text. When supplied, the icon is rendered at the larger size. |
type |
Alert type: |
closable |
Whether to show a close button. Default |
close_text |
Custom text for the close button. |
show_icon |
Whether to display the type icon. Default |
center |
Whether to centre the content. Default |
effect |
Visual effect: |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList with a Vue-managed alert component.
| Input | Reported | Value |
input$<id>_close |
unasked | fires when the user closes the alert |
The same list as el_events("el_alert"), which says how an event's arguments travel.
Server-side update for el_alert().
Every other argument of el_alert() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_alert() is called for its side effect and returns NULL invisibly.
el_alert("al1", "Operation successful", type = "success", show_icon = TRUE) el_alert("al2", "Warning!", description = "Please review.", type = "warning") if (interactive()) { # inside a server function observeEvent(input$go, { update_el_alert(session, "hint", title = "Saved", type = "success") }) }el_alert("al1", "Operation successful", type = "success", show_icon = TRUE) el_alert("al2", "Warning!", description = "Please review.", type = "warning") if (interactive()) { # inside a server function observeEvent(input$go, { update_el_alert(session, "hint", title = "Saved", type = "success") }) }
Links to sections of the page, the one in view marked as the page scrolls.
el_anchor( id = NULL, links = list(), container = NULL, offset = NULL, bound = NULL, duration = NULL, marker = NULL, type = NULL, direction = NULL, select_scroll_top = NULL, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_anchor( session = shiny::getDefaultReactiveDomain(), id, offset = NULL, bound = NULL, duration = NULL, marker = NULL, type = NULL, direction = NULL, select_scroll_top = NULL, container = NULL )el_anchor( id = NULL, links = list(), container = NULL, offset = NULL, bound = NULL, duration = NULL, marker = NULL, type = NULL, direction = NULL, select_scroll_top = NULL, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_anchor( session = shiny::getDefaultReactiveDomain(), id, offset = NULL, bound = NULL, duration = NULL, marker = NULL, type = NULL, direction = NULL, select_scroll_top = NULL, container = NULL )
id |
Anchor ID. Auto-generated if |
links |
The links, each an |
container |
A CSS selector for the element that scrolls, when it is not the page. |
offset |
Offset of the scroll position, in pixels. |
bound |
Distance from the top at which a section counts as reached,
in pixels. Default |
duration |
Duration of the scroll, in milliseconds. Default |
marker |
Whether to show the marker beside the current link. |
type |
|
direction |
|
select_scroll_top |
Whether a link counts as current once its section is scrolled to the top. |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents. |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the href of the current link, as the page scrolls |
input$<id>_click |
events = "click" |
the href of the link clicked
|
The same list as el_events("el_anchor"), which says how an event's arguments travel.
Callable with call_el(): scrollTo(href).
update_el_anchor() changes the component from the server: every argument of
el_anchor() that can change once it is drawn, under the same name. One left
NULL stays as it is; NA returns it to Element's default.
update_el_anchor() is called for its side effect and returns NULL invisibly.
el_anchor( "toc", links = list( list(title = "Basic usage", href = "#basic"), list( title = "API", href = "#api", children = list( list(title = "Attributes", href = "#attributes") ) ) ) )el_anchor( "toc", links = list( list(title = "Basic usage", href = "#basic"), list( title = "API", href = "#api", children = list( list(title = "Attributes", href = "#attributes") ) ) ) )
el_anchor()
Element Plus's el-anchor-link, for el_anchor(links =).
el_anchor_link(title, href, ...)el_anchor_link(title, href, ...)
title |
The link's text. |
href |
Where it points: |
... |
Links one level down, each an |
A link, for el_anchor(links =).
Other items:
el_breadcrumb_item(),
el_carousel_item(),
el_collapse_item(),
el_descriptions_item(),
el_dropdown_item(),
el_menu_item(),
el_option(),
el_skeleton_item(),
el_step(),
el_tab_pane(),
el_table_column(),
el_table_v2_column(),
el_timeline_item(),
el_tour_step()
el_anchor( "an", links = list( el_anchor_link("Basic Usage", "#basic-usage"), el_anchor_link( "API", "#api", el_anchor_link("Attributes", "#attributes"), el_anchor_link("Events", "#events") ) ) )el_anchor( "an", links = list( el_anchor_link("Basic Usage", "#basic-usage"), el_anchor_link( "API", "#api", el_anchor_link("Attributes", "#attributes"), el_anchor_link("Events", "#events") ) ) )
Element Plus Aside
el_aside(..., width = "300px", style = NULL, class = NULL)el_aside(..., width = "300px", style = NULL, class = NULL)
... |
Content. |
width |
Aside width. Defaults to |
style |
Extra inline style. |
class |
Extra CSS classes. |
A Shiny UI element.
el_aside("Navigation") el_aside(width = "200px", el_radio_group("nav", choices = c(Home = "h")))el_aside("Navigation") el_aside(width = "200px", el_radio_group("nav", choices = c(Home = "h")))
A text input that suggests as you type.
el_autocomplete( id = NULL, value = "", suggestions = NULL, remote = FALSE, fetch_suggestions = NULL, placeholder = NULL, clearable = NULL, disabled = NULL, value_key = NULL, debounce = NULL, placement = NULL, trigger_on_focus = NULL, select_when_unmatched = NULL, highlight_first_item = NULL, hide_loading = NULL, icon = NULL, prefix_icon = NULL, suffix_icon = NULL, label = NULL, name = NULL, popper_class = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, append_to = NULL, aria_label = NULL, fit_input_width = NULL, loop_navigation = NULL, popper_options = NULL, popper_style = NULL, show_arrow = NULL, teleported = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_autocomplete( session = shiny::getDefaultReactiveDomain(), id, value = NULL, suggestions = NULL, placeholder = NULL, disabled = NULL, label = NULL, error = NULL, clearable = NULL, value_key = NULL, debounce = NULL, placement = NULL, trigger_on_focus = NULL, select_when_unmatched = NULL, highlight_first_item = NULL, hide_loading = NULL, icon = NULL, prefix_icon = NULL, suffix_icon = NULL, name = NULL, popper_class = NULL, append_to = NULL, aria_label = NULL, fit_input_width = NULL, loop_navigation = NULL, popper_options = NULL, popper_style = NULL, show_arrow = NULL, teleported = NULL )el_autocomplete( id = NULL, value = "", suggestions = NULL, remote = FALSE, fetch_suggestions = NULL, placeholder = NULL, clearable = NULL, disabled = NULL, value_key = NULL, debounce = NULL, placement = NULL, trigger_on_focus = NULL, select_when_unmatched = NULL, highlight_first_item = NULL, hide_loading = NULL, icon = NULL, prefix_icon = NULL, suffix_icon = NULL, label = NULL, name = NULL, popper_class = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, append_to = NULL, aria_label = NULL, fit_input_width = NULL, loop_navigation = NULL, popper_options = NULL, popper_style = NULL, show_arrow = NULL, teleported = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_autocomplete( session = shiny::getDefaultReactiveDomain(), id, value = NULL, suggestions = NULL, placeholder = NULL, disabled = NULL, label = NULL, error = NULL, clearable = NULL, value_key = NULL, debounce = NULL, placement = NULL, trigger_on_focus = NULL, select_when_unmatched = NULL, highlight_first_item = NULL, hide_loading = NULL, icon = NULL, prefix_icon = NULL, suffix_icon = NULL, name = NULL, popper_class = NULL, append_to = NULL, aria_label = NULL, fit_input_width = NULL, loop_navigation = NULL, popper_options = NULL, popper_style = NULL, show_arrow = NULL, teleported = NULL )
id |
Input ID. Auto-generated if |
value |
Initial text. |
suggestions |
Suggestions to offer, as a character vector or a list of
|
remote |
Ask the server for suggestions as the user types, as
Element's |
fetch_suggestions |
|
placeholder |
Placeholder text. |
clearable |
Whether to show a clear button. |
disabled |
Whether the input is disabled. |
value_key |
Field of a suggestion object to display. Default
|
debounce |
Debounce while typing, in milliseconds. Default |
placement |
Where the list appears: |
trigger_on_focus |
Whether to suggest as soon as the input is focused.
Default |
select_when_unmatched |
Whether to fire |
highlight_first_item |
Whether to preselect the first suggestion. |
hide_loading |
Whether to hide the loading spinner. |
icon, prefix_icon, suffix_icon
|
Icon classes. |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
name |
Native |
popper_class |
Extra class name for the suggestion list. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
append_to |
Which select dropdown appends to. Element Plus's
|
aria_label |
Native |
fit_input_width |
Whether the width of the dropdown is the same as the
input. Element Plus's |
loop_navigation |
Whether keyboard navigation loops from end to start.
Element Plus's |
popper_options |
Popper.js parameters. Element Plus's |
popper_style |
Custom style for autocomplete's dropdown. Element
Plus's |
show_arrow |
Whether the dropdown has an arrow. Element Plus's
|
teleported |
Whether select dropdown is teleported to the body.
Element Plus's |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the current text |
input$<id>_query |
unasked | with remote = TRUE, the text to suggest for; answer with update_el_autocomplete() |
input$<id>_select |
unasked | triggers when a suggestion is clicked |
input$<id>_change |
events = "change" |
triggers when the icon inside Input value change |
input$<id>_blur |
events = "blur" |
triggers when Input blurs |
input$<id>_clear |
events = "clear" |
triggers when the Input is cleared by clicking the clear button |
input$<id>_focus |
events = "focus" |
triggers when Input focuses |
input$<id>_input |
events = "input" |
triggers when the Input value change |
The same list as el_events("el_autocomplete"), which says how an event's arguments travel.
Callable with call_el():
focus() – focus the input
Server-side update for el_autocomplete().
Every other argument of el_autocomplete() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_autocomplete() is called for its side effect and returns NULL invisibly.
el_autocomplete("city", suggestions = c("Beijing", "Shanghai", "Shenzhen")) el_autocomplete( "city", suggestions = c("Beijing", "Shanghai"), placeholder = "Where to?", clearable = TRUE, width = 260 ) if (interactive()) { # inside a server function observeEvent(input$country, { update_el_autocomplete( session, "city", suggestions = cities_of(input$country) ) }) }el_autocomplete("city", suggestions = c("Beijing", "Shanghai", "Shenzhen")) el_autocomplete( "city", suggestions = c("Beijing", "Shanghai"), placeholder = "Where to?", clearable = TRUE, width = 260 ) if (interactive()) { # inside a server function observeEvent(input$country, { update_el_autocomplete( session, "city", suggestions = cities_of(input$country) ) }) }
A user avatar, from an image, an icon, or text.
el_avatar( id = NULL, content = NULL, src = NULL, icon = NULL, size = NULL, shape = NULL, fit = NULL, src_set = NULL, alt = NULL, width = NULL, class = NULL, style = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_avatar( session = shiny::getDefaultReactiveDomain(), id, content = NULL, src = NULL, icon = NULL, size = NULL, shape = NULL, fit = NULL, src_set = NULL, alt = NULL )el_avatar( id = NULL, content = NULL, src = NULL, icon = NULL, size = NULL, shape = NULL, fit = NULL, src_set = NULL, alt = NULL, width = NULL, class = NULL, style = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_avatar( session = shiny::getDefaultReactiveDomain(), id, content = NULL, src = NULL, icon = NULL, size = NULL, shape = NULL, fit = NULL, src_set = NULL, alt = NULL )
id |
Avatar ID. Auto-generated if |
content |
Text shown when there is no |
src |
Image URL. |
icon |
Element icon class, such as |
size |
Size: |
shape |
|
fit |
How an image fills the avatar: |
src_set |
Candidate image sources, as a |
alt |
Alternative text for the image. |
width |
Component width, as a CSS unit. |
class, style
|
Extra classes and inline style on the avatar, as Element passes them to its root. |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
| Input | Reported | Value |
input$<id>_error |
unasked | trigger when image load error. |
The same list as el_events("el_avatar"), which says how an event's arguments travel.
Server-side update for el_avatar().
Every other argument of el_avatar() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_avatar() is called for its side effect and returns NULL invisibly.
el_avatar("me", src = "https://example.org/face.png") el_avatar("initials", content = "KY", shape = "square", size = 40) el_avatar("anon", icon = "el-icon-user-solid") if (interactive()) { # inside a server function observeEvent(input$sign_in, { update_el_avatar(session, "me", src = user_photo()) }) }el_avatar("me", src = "https://example.org/face.png") el_avatar("initials", content = "KY", shape = "square", size = 40) el_avatar("anon", icon = "el-icon-user-solid") if (interactive()) { # inside a server function observeEvent(input$sign_in, { update_el_avatar(session, "me", src = user_photo()) }) }
Avatars overlapping in a row, the overflow collapsed into a count.
el_avatar_group( ..., id = NULL, size = NULL, shape = NULL, collapse_avatars = NULL, collapse_avatars_tooltip = NULL, max_collapse_avatars = NULL, effect = NULL, placement = NULL, popper_class = NULL, popper_style = NULL, collapse_class = NULL, collapse_style = NULL, width = NULL, slots = NULL, on = NULL ) update_el_avatar_group( session = shiny::getDefaultReactiveDomain(), id, size = NULL, shape = NULL, collapse_avatars = NULL, collapse_avatars_tooltip = NULL, max_collapse_avatars = NULL, effect = NULL, placement = NULL, popper_class = NULL, popper_style = NULL, collapse_class = NULL, collapse_style = NULL )el_avatar_group( ..., id = NULL, size = NULL, shape = NULL, collapse_avatars = NULL, collapse_avatars_tooltip = NULL, max_collapse_avatars = NULL, effect = NULL, placement = NULL, popper_class = NULL, popper_style = NULL, collapse_class = NULL, collapse_style = NULL, width = NULL, slots = NULL, on = NULL ) update_el_avatar_group( session = shiny::getDefaultReactiveDomain(), id, size = NULL, shape = NULL, collapse_avatars = NULL, collapse_avatars_tooltip = NULL, max_collapse_avatars = NULL, effect = NULL, placement = NULL, popper_class = NULL, popper_style = NULL, collapse_class = NULL, collapse_style = NULL )
... |
Its content: any Shiny UI. Components of this package are folded
into this one's Vue instance, as |
id |
Component ID. Auto-generated if |
size |
Control the size of avatars in this avatar-group. Element
Plus's |
shape |
Control the shape of avatars in this avatar-group. Element
Plus's |
collapse_avatars |
Whether to collapse avatars. Element Plus's
|
collapse_avatars_tooltip |
Whether show all collapsed avatars when
mouse hover text of the collapse-avatar. To use this, |
max_collapse_avatars |
The max avatars number to be shown. To use
this, |
effect |
Tooltip theme, built-in theme: |
placement |
Placement of tooltip. Element Plus's |
popper_class |
Custom class name for tooltip. Element Plus's
|
popper_style |
Custom style for tooltip. Element Plus's |
collapse_class |
Custom class name for the collapse-avatar. Element
Plus's |
collapse_style |
Custom style for the collapse-avatar. Element Plus's
|
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents. A scoped slot is written
with |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
None: it reports nothing.
update_el_avatar_group() changes the component from the server: every argument of
el_avatar_group() that can change once it is drawn, under the same name. One left
NULL stays as it is; NA returns it to Element's default.
update_el_avatar_group() is called for its side effect and returns NULL invisibly.
el_avatar_group( el_avatar(src = "https://example.com/a.png"), el_avatar("B"), collapse_avatars = TRUE )el_avatar_group( el_avatar(src = "https://example.com/a.png"), el_avatar("B"), collapse_avatars = TRUE )
A button that appears once the page has been scrolled down, and returns it to the top when clicked.
el_backtop( id = NULL, content = NULL, target = NULL, visibility_height = NULL, right = NULL, bottom = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_backtop( session = shiny::getDefaultReactiveDomain(), id, visibility_height = NULL, right = NULL, bottom = NULL, target = NULL )el_backtop( id = NULL, content = NULL, target = NULL, visibility_height = NULL, right = NULL, bottom = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_backtop( session = shiny::getDefaultReactiveDomain(), id, visibility_height = NULL, right = NULL, bottom = NULL, target = NULL )
id |
Button ID. Auto-generated if |
content |
Contents of the button. |
target |
CSS selector of the element that scrolls. |
visibility_height |
Scroll distance in pixels before the button
appears. Default |
right |
Distance from the right edge, in pixels. Default |
bottom |
Distance from the bottom edge, in pixels. Default |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
| Input | Reported | Value |
input$<id>_click |
unasked | triggers when click. |
The same list as el_events("el_backtop"), which says how an event's arguments travel.
Server-side update for el_backtop().
Every other argument of el_backtop() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_backtop() is called for its side effect and returns NULL invisibly.
el_backtop("top") el_backtop("top", visibility_height = 100, right = 20, bottom = 20) # Scrolling a panel rather than the page el_backtop("panel_top", target = "#report") if (interactive()) { # inside a server function observeEvent(input$compact, { update_el_backtop(session, "top", right = 10, bottom = 10) }) }el_backtop("top") el_backtop("top", visibility_height = 100, right = 20, bottom = 20) # Scrolling a panel rather than the page el_backtop("panel_top", target = "#report") if (interactive()) { # inside a server function observeEvent(input$compact, { update_el_backtop(session, "top", right = 10, bottom = 10) }) }
Wraps any content with a numeric badge or red dot in the top-right corner. When used without content, renders a standalone badge element.
el_badge( ..., value = NULL, max = NULL, is_dot = FALSE, hidden = FALSE, type = NULL, id = NULL, show_zero = TRUE, color = NULL, offset = NULL, badge_style = NULL, badge_class = NULL, on = NULL ) update_el_badge( session = shiny::getDefaultReactiveDomain(), id, value = NULL, max = NULL, is_dot = NULL, hidden = NULL, type = NULL )el_badge( ..., value = NULL, max = NULL, is_dot = FALSE, hidden = FALSE, type = NULL, id = NULL, show_zero = TRUE, color = NULL, offset = NULL, badge_style = NULL, badge_class = NULL, on = NULL ) update_el_badge( session = shiny::getDefaultReactiveDomain(), id, value = NULL, max = NULL, is_dot = NULL, hidden = NULL, type = NULL )
... |
Content to wrap (e.g. a button or icon). |
value |
Badge value: number or string. Ignored when |
max |
Maximum numeric value to display. When |
is_dot |
Show a small dot instead of a number. Default |
|
Whether to hide the badge. Default |
|
type |
Badge colour type: |
id |
Give the badge an id and |
show_zero |
Whether a value of |
color |
Background colour of the badge. |
offset |
Offset of the badge, |
badge_style, badge_class
|
Extra CSS – a string or a named list – and class names for the badge. |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
An htmltools tag, or with an id a Shiny UI element.
Server-side update for an el_badge() given an id.
update_el_badge() is called for its side effect and returns NULL invisibly.
el_badge(el_button("btn1", "Messages"), value = 5) el_badge(el_button("btn2", "Alerts"), value = 200, max = 99) el_badge(el_button("btn3", "Updates"), is_dot = TRUE) # Updated from the server: update_el_badge(session, "unread", value = 7) el_badge(el_button("inbox", "Inbox"), value = 3, id = "unread") if (interactive()) { # inside a server function observe(update_el_badge( session, "unread", value = unread_count(), hidden = unread_count() == 0 )) }el_badge(el_button("btn1", "Messages"), value = 5) el_badge(el_button("btn2", "Alerts"), value = 200, max = 99) el_badge(el_button("btn3", "Updates"), is_dot = TRUE) # Updated from the server: update_el_badge(session, "unread", value = 7) el_badge(el_button("inbox", "Inbox"), value = 3, id = "unread") if (interactive()) { # inside a server function observe(update_el_badge( session, "unread", value = unread_count(), hidden = unread_count() == 0 )) }
A trail of links showing where a page sits.
el_breadcrumb( id = NULL, items = list(), separator = NULL, separator_icon = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_breadcrumb( session = shiny::getDefaultReactiveDomain(), id, items = NULL, separator = NULL, separator_icon = NULL )el_breadcrumb( id = NULL, items = list(), separator = NULL, separator_icon = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_breadcrumb( session = shiny::getDefaultReactiveDomain(), id, items = NULL, separator = NULL, separator_icon = NULL )
id |
Breadcrumb ID. Auto-generated if |
items |
The trail, a list of |
separator |
Separator character. Default |
separator_icon |
Icon component of icon separator. Element Plus's
|
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents, such as
|
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the label of the step last clicked
|
The same list as el_events("el_breadcrumb"), which says how an event's arguments travel.
Steps without a to are reported too, so a breadcrumb can drive
navigation inside a Shiny app without any routing.
Server-side update for el_breadcrumb().
Every other argument of el_breadcrumb() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_breadcrumb() is called for its side effect and returns NULL invisibly.
el_breadcrumb( "trail", items = list( list(label = "Home"), list(label = "Reports"), list(label = "March") ) ) # An arrow instead of a slash el_breadcrumb( "trail", items = list(list(label = "Home"), list(label = "Detail")), separator_icon = "ArrowRight" ) if (interactive()) { # inside a server function observeEvent(input$open_detail, { update_el_breadcrumb( session, "trail", items = list( list(label = "Home"), list(label = "Detail") ) ) }) }el_breadcrumb( "trail", items = list( list(label = "Home"), list(label = "Reports"), list(label = "March") ) ) # An arrow instead of a slash el_breadcrumb( "trail", items = list(list(label = "Home"), list(label = "Detail")), separator_icon = "ArrowRight" ) if (interactive()) { # inside a server function observeEvent(input$open_detail, { update_el_breadcrumb( session, "trail", items = list( list(label = "Home"), list(label = "Detail") ) ) }) }
el_breadcrumb()
Element Plus's el-breadcrumb-item, for el_breadcrumb(items =).
el_breadcrumb_item(label, to = NULL, replace = NULL)el_breadcrumb_item(label, to = NULL, replace = NULL)
label |
The step's text. |
to |
Where the step links to; the last step usually has none. |
replace |
Navigate without leaving a history record. |
A step, for el_breadcrumb(items =).
Other items:
el_anchor_link(),
el_carousel_item(),
el_collapse_item(),
el_descriptions_item(),
el_dropdown_item(),
el_menu_item(),
el_option(),
el_skeleton_item(),
el_step(),
el_tab_pane(),
el_table_column(),
el_table_v2_column(),
el_timeline_item(),
el_tour_step()
el_breadcrumb( "bc", items = list( el_breadcrumb_item("Home", to = "/"), el_breadcrumb_item("Promotion list") ) )el_breadcrumb( "bc", items = list( el_breadcrumb_item("Home", to = "/"), el_breadcrumb_item("Promotion list") ) )
Creates an Element Plus button with Vue instance, supporting all Element Plus
button variants including plain, round, circle, and loading states.
el_button( id = NULL, label = "Button", type = NULL, size = NULL, plain = NULL, round = NULL, circle = FALSE, loading = FALSE, task = FALSE, disabled = FALSE, icon = NULL, native_type = "button", autofocus = FALSE, auto_insert_space = NULL, bg = NULL, color = NULL, dark = NULL, dashed = NULL, link = NULL, loading_icon = NULL, tag = NULL, text = NULL, class = NULL, style = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_button( session = shiny::getDefaultReactiveDomain(), id, label = NULL, type = NULL, size = NULL, plain = NULL, round = NULL, loading = NULL, disabled = NULL, circle = NULL, icon = NULL, autofocus = NULL, auto_insert_space = NULL, bg = NULL, color = NULL, dark = NULL, dashed = NULL, link = NULL, loading_icon = NULL, tag = NULL, text = NULL )el_button( id = NULL, label = "Button", type = NULL, size = NULL, plain = NULL, round = NULL, circle = FALSE, loading = FALSE, task = FALSE, disabled = FALSE, icon = NULL, native_type = "button", autofocus = FALSE, auto_insert_space = NULL, bg = NULL, color = NULL, dark = NULL, dashed = NULL, link = NULL, loading_icon = NULL, tag = NULL, text = NULL, class = NULL, style = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_button( session = shiny::getDefaultReactiveDomain(), id, label = NULL, type = NULL, size = NULL, plain = NULL, round = NULL, loading = NULL, disabled = NULL, circle = NULL, icon = NULL, autofocus = NULL, auto_insert_space = NULL, bg = NULL, color = NULL, dark = NULL, dashed = NULL, link = NULL, loading_icon = NULL, tag = NULL, text = NULL )
id |
Button ID. Auto-generated UUID if |
label |
Button text, or tags – |
type |
Button type: |
size |
Size: |
plain |
Whether to use the plain (hollow) style. |
round |
Whether to use rounded corners. |
circle |
Whether to render as a circle button (icon only, no label).
Default |
loading |
Whether to show loading spinner. Disables click while active. |
task |
A task button, as |
disabled |
Whether the button is disabled. Default |
icon |
Either an Element icon class name such as |
native_type |
HTML native button type: |
autofocus |
Whether the button takes focus on page load. Default |
auto_insert_space |
Automatically insert a space between two chinese
characters(this will only take effect when the text length is 2 and all
characters are in Chinese.). Element Plus's |
bg |
Determine whether the text button background color is always on.
Element Plus's |
color |
Custom button color, automatically calculate |
dark |
Dark mode, which automatically converts |
dashed |
Determine whether it's a dashed button. Element Plus's
|
link |
Determine whether it's a link button. Element Plus's |
loading_icon |
Customize loading icon component. Element Plus's
|
tag |
Custom element tag. Element Plus's |
text |
Determine whether it's a text button. Element Plus's |
class, style
|
Extra classes and inline style on the button, as Element passes them to its root. |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList with a Vue-managed button component.
| Input | Reported | Value |
input$<id> |
unasked | the number of clicks, as actionButton() reports it
|
The same list as el_events("el_button"), which says how an event's arguments travel.
Counted as shiny::actionButton() counts: 0 on load, and only while
neither disabled nor loading is TRUE. It carries the same class, so
observeEvent() and req() treat 0 as not yet clicked.
Server-side update for el_button(). Supports all visual states including
size, plain, round, and loading.
Every other argument of el_button() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_button() is called for its side effect and returns NULL invisibly.
# Basic usage el_button("btn_primary", "Primary", type = "primary") # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_button("btn1", "Primary", type = "primary"), verbatimTextOutput("count") ) server <- function(input, output, session) { output$count <- renderPrint(input$btn1) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_button(session, "save", loading = TRUE) }) }# Basic usage el_button("btn_primary", "Primary", type = "primary") # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_button("btn1", "Primary", type = "primary"), verbatimTextOutput("count") ) server <- function(input, output, session) { output$count <- renderPrint(input$btn1) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_button(session, "save", loading = TRUE) }) }
Buttons joined into one bar, as Element's el-button-group draws them:
shared borders, rounded only at the ends. Each el_button() inside keeps
reporting its own clicks as input$<its id>.
el_button_group( ..., id = NULL, size = NULL, type = NULL, direction = NULL, width = NULL, on = NULL ) update_el_button_group( session = shiny::getDefaultReactiveDomain(), id, size = NULL, type = NULL, direction = NULL )el_button_group( ..., id = NULL, size = NULL, type = NULL, direction = NULL, width = NULL, on = NULL ) update_el_button_group( session = shiny::getDefaultReactiveDomain(), id, size = NULL, type = NULL, direction = NULL )
... |
Buttons: |
id |
Group ID. Auto-generated if |
size, type
|
The size and type of every button in the group, as
Element Plus's group hands them down: |
direction |
|
width |
Component width, as a CSS unit. |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
The buttons are folded into the group's Vue instance rather than nested
(see el_tooltip()): Element styles the group through its direct
children, which a button with a host of its own would not be. So
update_el_button() cannot reach them; set their fields with
update_vue() on the group's id.
A Shiny UI element.
update_el_button_group() changes the component from the server: every argument of
el_button_group() that can change once it is drawn, under the same name. One left
NULL stays as it is; NA returns it to Element's default.
update_el_button_group() is called for its side effect and returns NULL invisibly.
el_button_group( el_button("prev", "Previous", icon = "ArrowLeft", type = "primary"), el_button("next", "Next", type = "primary") )el_button_group( el_button("prev", "Previous", icon = "ArrowLeft", type = "primary"), el_button("next", "Next", type = "primary") )
A month of days to pick one from, or a range of weeks to show – and,
with events, a month planner: each day shows its events, which the
user can add, edit, delete and drag to another day (editable).
Days show times, groups (calendars) and a "+N more" beyond
visible_event_count; the dialog and the popovers take Element's
components of your own through slots.
el_calendar( id = NULL, value = NULL, range = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, controller_type = NULL, formatter = NULL, width = NULL, slots = NULL, session = NULL, events = NULL, editable = FALSE, event_labels = NULL, calendars = NULL, visible_event_count = NULL, use_detail_popup = FALSE, first_day_of_week = NULL, workweek = FALSE ) update_el_calendar( session = shiny::getDefaultReactiveDomain(), id, value = NULL, range = NULL, label = NULL, error = NULL, controller_type = NULL, formatter = NULL, events = NULL, insert = NULL, replace = NULL, delete = NULL, editable = NULL, event_labels = NULL, calendars = NULL, visible_event_count = NULL, use_detail_popup = NULL, first_day_of_week = NULL, workweek = NULL )el_calendar( id = NULL, value = NULL, range = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, controller_type = NULL, formatter = NULL, width = NULL, slots = NULL, session = NULL, events = NULL, editable = FALSE, event_labels = NULL, calendars = NULL, visible_event_count = NULL, use_detail_popup = FALSE, first_day_of_week = NULL, workweek = FALSE ) update_el_calendar( session = shiny::getDefaultReactiveDomain(), id, value = NULL, range = NULL, label = NULL, error = NULL, controller_type = NULL, formatter = NULL, events = NULL, insert = NULL, replace = NULL, delete = NULL, editable = NULL, event_labels = NULL, calendars = NULL, visible_event_count = NULL, use_detail_popup = NULL, first_day_of_week = NULL, workweek = NULL )
id |
Calendar ID (auto-generated if NULL) |
value |
Bound value (Date/string/number) |
range |
Date range, c("YYYY-MM-DD", "YYYY-MM-DD") |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
controller_type |
How the header switches month and year: |
formatter |
With |
width |
Component width, as a CSS unit – |
slots |
Named list of slot contents. Element's: |
session |
Deprecated. Inside a module, wrap |
events |
Element's events to report besides those reported unasked,
by name: |
editable |
Whether the user can change the events: double-click a
day, or drag across several, to add one; click an event to edit or
delete it in a dialog; drag it to another day to move it (its times
and a span's length kept). An event with |
event_labels |
The dialog's and popovers' words, to change any of: a
named list of |
calendars |
Groups of events, toastui's: a data.frame, or a list of
rows, with |
visible_event_count |
How many events a day shows; the rest are
behind a "+N more" that lists them in a popover. |
use_detail_popup |
Whether a click on an event the user cannot edit
shows it in a popover: its title, when, calendar and body, or the
|
first_day_of_week |
The day the week starts on, |
workweek |
Whether to hide Saturday and Sunday, as toastui's
|
insert |
Events to add, each with its |
replace |
Events to put in place of those with the same |
delete |
The |
The server owns the events, as toastui's calendar has it: what the user
does arrives as a request – input$<id>_add, _update, _delete –
and the calendar changes when the server answers with
update_el_calendar() (insert, replace, delete, or all of them
with events). So the server can check a change, give a new event its
id from a database, or refuse. Without Shiny – a static page – the
calendar applies the user's changes itself.
A Shiny UI element.
| Input | When | Value |
input$<id> |
on load and when a day is picked | the day, "YYYY-MM-DD" |
input$<id>_dates |
on load and when another month is shown | list(current, start, end), Dates: the day the calendar is on and the first and last days drawn |
input$<id>_click |
an event is clicked | the event, a list with its days as Dates and its times as date-times (the time shown, in the R session's time zone) |
input$<id>_add |
the user saves a new event (editable) |
the event asked for, without an id: list(date, end, title, type, body), its calendarId with calendars, and the fields of an eventForm slot |
input$<id>_update |
the user saves an edit or drops an event on another day | list(event, changes): the event as it is, and what to change -- toastui's shape |
input$<id>_delete |
the user deletes an event | the event |
The requests change nothing by themselves: answer them with
update_el_calendar(), as the example does.
Server-side update for el_calendar(): the selected day, the range, and
every other argument that can change once the calendar is drawn, under
the same name. One left NULL stays as it is; NA returns a prop to
Element's default.
events replaces all the events; insert, replace and delete
change a few, found by id, and send only those – one of the four per
call. calendars replaces the groups: an isVisible = FALSE hides a
group's events, as toastui's cal_proxy_toggle() does.
update_el_calendar() is called for its side effect and returns NULL invisibly.
# The default day cell el_calendar("cal") # Your own, with whatever Element hands the template el_calendar( "cal", slots = list( dateCell = template( htmltools::HTML("<p>{{ data.day.slice(8) }}</p>"), slot = "dateCell", scope = "{date, data}" ) ) ) # Basic usage el_calendar(id = "calendar1", value = Sys.Date()) # With date range el_calendar(id = "calendar2", range = c("2025-01-01", "2025-01-31")) # A planner whose events the server keeps, rendered as an output: each # request changes them, and the calendar is rendered again -- patched, # only the events sent if (interactive()) { library(shiny) library(shiny.element) ui <- el_page(el_calendar_output("plan")) server <- function(input, output, session) { events <- reactiveVal(data.frame( id = 1:2, date = Sys.Date() + c(0, 3), title = c("Standup", "Review"), type = c("primary", "warning") )) output$plan <- render_el_calendar( el_calendar(events = events(), editable = TRUE) ) observeEvent(input$plan_add, { new <- input$plan_add events(rbind( events(), data.frame( id = max(events()$id) + 1L, date = new$date, title = new$title, type = new$type ) )) }) observeEvent(input$plan_update, { d <- events() i <- d$id == input$plan_update$event$id for (k in intersect(names(input$plan_update$changes), names(d))) { d[[k]][i] <- input$plan_update$changes[[k]] } events(d) }) observeEvent(input$plan_delete, { events(events()[events()$id != input$plan_delete$id, ]) }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_calendar(session, "cal", value = "2026-06-01") }) update_el_calendar(session, "cal", controller_type = "select") }# The default day cell el_calendar("cal") # Your own, with whatever Element hands the template el_calendar( "cal", slots = list( dateCell = template( htmltools::HTML("<p>{{ data.day.slice(8) }}</p>"), slot = "dateCell", scope = "{date, data}" ) ) ) # Basic usage el_calendar(id = "calendar1", value = Sys.Date()) # With date range el_calendar(id = "calendar2", range = c("2025-01-01", "2025-01-31")) # A planner whose events the server keeps, rendered as an output: each # request changes them, and the calendar is rendered again -- patched, # only the events sent if (interactive()) { library(shiny) library(shiny.element) ui <- el_page(el_calendar_output("plan")) server <- function(input, output, session) { events <- reactiveVal(data.frame( id = 1:2, date = Sys.Date() + c(0, 3), title = c("Standup", "Review"), type = c("primary", "warning") )) output$plan <- render_el_calendar( el_calendar(events = events(), editable = TRUE) ) observeEvent(input$plan_add, { new <- input$plan_add events(rbind( events(), data.frame( id = max(events()$id) + 1L, date = new$date, title = new$title, type = new$type ) )) }) observeEvent(input$plan_update, { d <- events() i <- d$id == input$plan_update$event$id for (k in intersect(names(input$plan_update$changes), names(d))) { d[[k]][i] <- input$plan_update$changes[[k]] } events(d) }) observeEvent(input$plan_delete, { events(events()[events()$id != input$plan_delete$id, ]) }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_calendar(session, "cal", value = "2026-06-01") }) update_el_calendar(session, "cal", controller_type = "select") }
What the browser holds, as R: the events last rendered with
render_el_calendar() or sent with update_el_calendar(), with every
event update_el_calendar() has since inserted, replaced or deleted. The
user's requests (input$<id>_add, ...) are not in it until the server
answers them. A reactive read.
el_calendar_events(session = shiny::getDefaultReactiveDomain(), id)el_calendar_events(session = shiny::getDefaultReactiveDomain(), id)
session |
The Shiny session, the current one by default. |
id |
The calendar's id, the output's. |
The events, as given; NULL for a calendar the server has not
rendered or updated.
render_el_calendar(), update_el_calendar().
if (interactive()) { library(shiny) ui <- el_page(el_calendar_output("plan"), verbatimTextOutput("n")) server <- function(input, output, session) { output$plan <- render_el_calendar(el_calendar( events = data.frame(id = 1, date = Sys.Date(), title = "Review") )) # the events the calendar shows, read back as R output$n <- renderText(nrow(el_calendar_events(id = "plan"))) } shinyApp(ui, server) }if (interactive()) { library(shiny) ui <- el_page(el_calendar_output("plan"), verbatimTextOutput("n")) server <- function(input, output, session) { output$plan <- render_el_calendar(el_calendar( events = data.frame(id = 1, date = Sys.Date(), title = "Review") )) # the events the calendar shows, read back as R output$n <- renderText(nrow(el_calendar_events(id = "plan"))) } shinyApp(ui, server) }
The calendar of an app whose events the server reads – from a
database, a folder, a computation – as toastui's calendarOutput() and
renderCalendar(): the page holds el_calendar_output(), the server
renders el_calendar() into it with its events. Rendering again with
new events patches the calendar in place: the month shown and an open
dialog stay, and only what changed is sent.
el_calendar_output(outputId, width = "100%", loading = TRUE) render_el_calendar(expr, env = parent.frame(), quoted = FALSE)el_calendar_output(outputId, width = "100%", loading = TRUE) render_el_calendar(expr, env = parent.frame(), quoted = FALSE)
outputId |
The output's id. |
width |
The calendar's width, as a CSS unit. |
loading |
Whether Element's loading mask covers the calendar while Shiny recalculates it, in place of Shiny fading the output. |
expr |
An expression returning |
env, quoted
|
As for |
The output's id is the calendar's: input$<id> is the day picked and
input$<id>_click, _dates, _add, _update, _delete are as for
el_calendar(); update_el_calendar() reaches the calendar by it, and
el_calendar_events() reads the events it shows.
el_calendar_output(), a tag; render_el_calendar(), a render
function.
el_calendar(), update_el_calendar(), el_calendar_events().
if (interactive()) { library(shiny) archive <- data.frame( date = Sys.Date() - c(9, 6, 2), title = c("", "", "Validated"), body = c("Raw data", "Archive", "Validated data"), color = c("lightgrey", "#EED5B7", "#E9C46B") ) ui <- el_page(el_calendar_output("snapshot"), verbatimTextOutput("picked")) server <- function(input, output, session) { output$snapshot <- render_el_calendar( el_calendar(value = max(archive$date), events = archive) ) output$picked <- renderPrint(input$snapshot_click$date) } shinyApp(ui, server) }if (interactive()) { library(shiny) archive <- data.frame( date = Sys.Date() - c(9, 6, 2), title = c("", "", "Validated"), body = c("Raw data", "Archive", "Validated data"), color = c("lightgrey", "#EED5B7", "#E9C46B") ) ui <- el_page(el_calendar_output("snapshot"), verbatimTextOutput("picked")) server <- function(input, output, session) { output$snapshot <- render_el_calendar( el_calendar(value = max(archive$date), events = archive) ) output$picked <- renderPrint(input$snapshot_click$date) } shinyApp(ui, server) }
A card container with optional header and body. Supports always, hover,
and never shadow modes.
el_card( ..., header = NULL, body_style = NULL, shadow = NULL, footer = NULL, header_class = NULL, body_class = NULL, footer_class = NULL, class = NULL, style = NULL )el_card( ..., header = NULL, body_style = NULL, shadow = NULL, footer = NULL, header_class = NULL, body_class = NULL, footer_class = NULL, class = NULL, style = NULL )
... |
Content placed inside the card body. |
header |
Header content (string or tag). |
body_style |
CSS for the card body, a string or a named list. |
shadow |
Shadow display trigger: |
footer |
Footer content (string or tag). |
header_class, body_class, footer_class
|
Extra class names for the header, the body and the footer. |
class, style
|
Extra classes and inline style on the card itself, as Element passes them to its root. |
An htmltools tag.
el_card(shiny::tags$p("Card body text."), header = "My Card") el_card(shiny::tags$p("No shadow."), shadow = "never")el_card(shiny::tags$p("Card body text."), header = "My Card") el_card(shiny::tags$p("No shadow."), shadow = "never")
A slideshow of items, horizontal or vertical.
el_carousel( id = NULL, items = list(), height = "300px", initial_index = 0, autoplay = TRUE, interval = 3000, trigger = "hover", indicator_position = NULL, arrow = "hover", type = NULL, loop = TRUE, direction = "horizontal", card_scale = NULL, motion_blur = NULL, pause_on_hover = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_carousel( session = shiny::getDefaultReactiveDomain(), id, active = NULL, autoplay = NULL, interval = NULL, height = NULL, initial_index = NULL, trigger = NULL, indicator_position = NULL, arrow = NULL, loop = NULL, direction = NULL )el_carousel( id = NULL, items = list(), height = "300px", initial_index = 0, autoplay = TRUE, interval = 3000, trigger = "hover", indicator_position = NULL, arrow = "hover", type = NULL, loop = TRUE, direction = "horizontal", card_scale = NULL, motion_blur = NULL, pause_on_hover = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_carousel( session = shiny::getDefaultReactiveDomain(), id, active = NULL, autoplay = NULL, interval = NULL, height = NULL, initial_index = NULL, trigger = NULL, indicator_position = NULL, arrow = NULL, loop = NULL, direction = NULL )
id |
Carousel ID (auto-generated if NULL). |
items |
A list of slides, each an |
height |
Slide height, e.g. |
initial_index |
Index of the slide shown first, 0-based. |
autoplay |
Cycle through the slides on a timer. |
interval |
Milliseconds between slides when |
trigger |
What switches slides when an indicator is used:
|
indicator_position |
|
arrow |
When to show the arrows: |
type |
|
loop |
Return to the first slide after the last. |
direction |
|
card_scale |
When type is card, scaled size of secondary cards.
Element Plus's |
motion_blur |
Infuse dynamism and smoothness into the carousel.
Element Plus's |
pause_on_hover |
Pause autoplay when hover. Element Plus's
|
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
active |
Index of the slide to show, 0-based. |
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the index of the slide showing, from 0 |
input$<id>_name |
unasked | its name, if it has one
|
The same list as el_events("el_carousel"), which says how an event's arguments travel.
Callable with call_el():
next() – Switch to the next slide
prev() – Switch to the previous slide
setActiveItem() – Manually switch slide
update_el_carousel() changes the component from the server.
Every other argument of el_carousel() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_carousel() is called for its side effect and returns NULL invisibly.
el_carousel( id = "banner", height = "200px", items = list( list(name = "one", content = shiny::tags$h3("First slide")), list(name = "two", content = shiny::tags$h3("Second slide")), list(name = "three", content = shiny::tags$h3("Third slide")) ) ) # Card layout, switching on click rather than hover el_carousel( id = "cards", type = "card", trigger = "click", height = "180px", items = lapply(1:4, function(i) list(content = paste("Card", i))) ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_carousel(session, "banner", active = 2) }) }el_carousel( id = "banner", height = "200px", items = list( list(name = "one", content = shiny::tags$h3("First slide")), list(name = "two", content = shiny::tags$h3("Second slide")), list(name = "three", content = shiny::tags$h3("Third slide")) ) ) # Card layout, switching on click rather than hover el_carousel( id = "cards", type = "card", trigger = "click", height = "180px", items = lapply(1:4, function(i) list(content = paste("Card", i))) ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_carousel(session, "banner", active = 2) }) }
el_carousel()
Element Plus's el-carousel-item, for el_carousel(items =).
el_carousel_item(..., name = NULL, label = NULL, style = NULL, class = NULL)el_carousel_item(..., name = NULL, label = NULL, style = NULL, class = NULL)
... |
The slide's content. |
name |
The slide's value, |
label |
Text of the slide's indicator. |
style, class
|
The slide's own inline style and classes – a height
of its own in a carousel of |
A slide, for el_carousel(items =).
Other items:
el_anchor_link(),
el_breadcrumb_item(),
el_collapse_item(),
el_descriptions_item(),
el_dropdown_item(),
el_menu_item(),
el_option(),
el_skeleton_item(),
el_step(),
el_tab_pane(),
el_table_column(),
el_table_v2_column(),
el_timeline_item(),
el_tour_step()
el_carousel( "car", items = list( el_carousel_item(htmltools::tags$h3("1"), name = "first"), el_carousel_item(htmltools::tags$h3("2"), name = "second") ) )el_carousel( "car", items = list( el_carousel_item(htmltools::tags$h3("1"), name = "first"), el_carousel_item(htmltools::tags$h3("2"), name = "second") ) )
Pick a path through nested options – a region, then a country, then a city – from a dropdown of side-by-side columns.
el_cascader( id = NULL, options = list(), value = NULL, placeholder = "Please select", props = NULL, clearable = FALSE, filterable = FALSE, disabled = FALSE, size = NULL, show_all_levels = TRUE, collapse_tags = FALSE, separator = " / ", debounce = 300, popper_class = NULL, filter_method = NULL, before_filter = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, clear_icon = NULL, collapse_tags_tooltip = NULL, effect = NULL, empty_values = NULL, fallback_placements = NULL, fit_input_width = NULL, height = NULL, item_size = NULL, max_collapse_tags = NULL, max_collapse_tags_tooltip_height = NULL, persistent = NULL, placement = NULL, popper_append_to_body = NULL, popper_style = NULL, show_checked_strategy = NULL, tag_effect = NULL, tag_type = NULL, teleported = NULL, validate_event = NULL, value_on_clear = NULL, virtual_scroll = NULL, width = NULL, slots = NULL, level_inputs = NULL, events = NULL, on = NULL, session = NULL ) update_el_cascader( session = shiny::getDefaultReactiveDomain(), id, options = NULL, value = NULL, placeholder = NULL, clearable = NULL, filterable = NULL, disabled = NULL, label = NULL, error = NULL, props = NULL, size = NULL, show_all_levels = NULL, collapse_tags = NULL, separator = NULL, debounce = NULL, popper_class = NULL, filter_method = NULL, before_filter = NULL, clear_icon = NULL, collapse_tags_tooltip = NULL, effect = NULL, empty_values = NULL, fallback_placements = NULL, fit_input_width = NULL, height = NULL, item_size = NULL, max_collapse_tags = NULL, max_collapse_tags_tooltip_height = NULL, persistent = NULL, placement = NULL, popper_append_to_body = NULL, popper_style = NULL, show_checked_strategy = NULL, tag_effect = NULL, tag_type = NULL, teleported = NULL, validate_event = NULL, value_on_clear = NULL, virtual_scroll = NULL )el_cascader( id = NULL, options = list(), value = NULL, placeholder = "Please select", props = NULL, clearable = FALSE, filterable = FALSE, disabled = FALSE, size = NULL, show_all_levels = TRUE, collapse_tags = FALSE, separator = " / ", debounce = 300, popper_class = NULL, filter_method = NULL, before_filter = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, clear_icon = NULL, collapse_tags_tooltip = NULL, effect = NULL, empty_values = NULL, fallback_placements = NULL, fit_input_width = NULL, height = NULL, item_size = NULL, max_collapse_tags = NULL, max_collapse_tags_tooltip_height = NULL, persistent = NULL, placement = NULL, popper_append_to_body = NULL, popper_style = NULL, show_checked_strategy = NULL, tag_effect = NULL, tag_type = NULL, teleported = NULL, validate_event = NULL, value_on_clear = NULL, virtual_scroll = NULL, width = NULL, slots = NULL, level_inputs = NULL, events = NULL, on = NULL, session = NULL ) update_el_cascader( session = shiny::getDefaultReactiveDomain(), id, options = NULL, value = NULL, placeholder = NULL, clearable = NULL, filterable = NULL, disabled = NULL, label = NULL, error = NULL, props = NULL, size = NULL, show_all_levels = NULL, collapse_tags = NULL, separator = NULL, debounce = NULL, popper_class = NULL, filter_method = NULL, before_filter = NULL, clear_icon = NULL, collapse_tags_tooltip = NULL, effect = NULL, empty_values = NULL, fallback_placements = NULL, fit_input_width = NULL, height = NULL, item_size = NULL, max_collapse_tags = NULL, max_collapse_tags_tooltip_height = NULL, persistent = NULL, placement = NULL, popper_append_to_body = NULL, popper_style = NULL, show_checked_strategy = NULL, tag_effect = NULL, tag_type = NULL, teleported = NULL, validate_event = NULL, value_on_clear = NULL, virtual_scroll = NULL )
id |
Cascader ID (auto-generated if NULL) |
options |
Nested options, each |
value |
Initially selected path, as a vector of values from the top
level down – or a list of paths with |
placeholder |
Placeholder text |
props |
Element's |
clearable |
Whether clearable |
filterable |
Whether filterable (searchable) |
disabled |
Whether disabled |
size |
Size of cascader: |
show_all_levels |
Whether to show all levels in input |
collapse_tags |
Whether to collapse tags in multiple mode |
separator |
Separator for display |
debounce |
Debounce delay for filter |
popper_class |
Extra class name for the dropdown panel. |
filter_method |
|
before_filter |
|
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
clear_icon |
Custom clear icon component. Element Plus's |
collapse_tags_tooltip |
Whether show all selected tags when mouse
hover text of collapse-tags. To use this, |
effect |
Tooltip theme, built-in theme: |
empty_values |
Empty values of component, see config-provider. Element
Plus's |
fallback_placements |
List of possible positions for Tooltip
popper.js. Element Plus's |
fit_input_width |
Whether the width of the suggestion panel is the
same as the input, if the value is |
height |
Menu height for virtual scrolling (px). Element Plus's
|
item_size |
Node height for virtual scrolling (px). Element Plus's
|
max_collapse_tags |
The max tags number to be shown. To use this,
|
max_collapse_tags_tooltip_height |
Max height of collapse-tags
tooltip. Element Plus's |
persistent |
When dropdown is inactive and |
placement |
Position of dropdown. Element Plus's |
popper_append_to_body |
Whether to append the popper menu to body. If
the positioning of the popper is wrong, you can try to set this prop to
false. Element Plus's |
popper_style |
Custom style for Cascader's dropdown and tags' tooltip.
Element Plus's |
show_checked_strategy |
Strategy for displaying checked nodes in
multiple selection mode. Use |
tag_effect |
Tag effect. Element Plus's |
tag_type |
Tag type. Element Plus's |
teleported |
Whether cascader popup is teleported. Element Plus's
|
validate_event |
Whether to trigger form validation. Element Plus's
|
value_on_clear |
Clear return value, see config-provider. Element
Plus's |
virtual_scroll |
Whether to enable virtual scrolling for large data.
Element Plus's |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
level_inputs |
Each level of the path as an input of its own, beside
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the selected path |
input$<id>_lazy_load |
unasked | with props = list(lazy = TRUE), a column to load; answer with el_load_children() |
input$<id>_expand_change |
events = "expand_change" |
triggers when expand option changes |
input$<id>_blur |
events = "blur" |
triggers when Cascader blurs |
input$<id>_focus |
events = "focus" |
triggers when Cascader focuses |
input$<id>_visible_change |
events = "visible_change" |
triggers when the dropdown appears/disappears |
input$<id>_remove_tag |
events = "remove_tag" |
triggers when remove tag in multiple selection mode |
input$<id>_clear |
events = "clear" |
triggers when the clear icon is clicked in a clearable Select |
The same list as el_events("el_cascader"), which says how an event's arguments travel.
With level_inputs, each level of the path is an input too, named as
given – not prefixed with the cascader's id, as the levels are the
cascader's value in parts rather than something it does. Each holds
that level's value, NULL where the path stops short (nothing
selected, or checkStrictly), and follows the path wherever it
changes: on load, when the user picks, when update_el_cascader() sets
it. Like any input, it notifies its observers only when its value
changes, so an observer of input$compound does not run again when
only the study changes. The ids are the page's: in a module, give them
through ns(), level_inputs = ns(c("compound", "study")), as the
cascader's own id. It needs the value to be one path, so not with
props = list(multiple = TRUE) or emitPath = FALSE.
input$<id>_lazy_load carries level (0 for the first column), value
and path of the option opened, and request. Answer with
el_load_children(), passing the input back; each child is list(value =, label =, leaf = TRUE) for one with nothing below.
Callable with call_el():
getCheckedNodes() – Get an array of currently selected node
update_el_cascader() changes the component from the server.
Every other argument of el_cascader() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_cascader() is called for its side effect and returns NULL invisibly.
# Basic cascader usage cascader_options <- list( list( value = "guide", label = "Guide", children = list( list(value = "principle", label = "Principle"), list(value = "navigation", label = "Navigation") ) ), list( value = "component", label = "Component", children = list( list(value = "basic", label = "Basic"), list(value = "form", label = "Form", disabled = TRUE) ) ) ) if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_cascader( id = "cascader1", options = cascader_options, placeholder = "Please select", clearable = TRUE ), verbatimTextOutput("selected") ) server <- function(input, output, session) { output$selected <- renderPrint(input$cascader1) } shinyApp(ui, server) } # Advanced: custom props and update custom_props <- list( expandTrigger = "hover", multiple = FALSE, checkStrictly = FALSE, emitPath = TRUE, lazy = FALSE, value = "value", label = "label", children = "children" ) # Update cascader options in server: # update_el_cascader(session, "cascader1", options = new_options) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_cascader(session, "region", value = list("zj", "hz")) }) }# Basic cascader usage cascader_options <- list( list( value = "guide", label = "Guide", children = list( list(value = "principle", label = "Principle"), list(value = "navigation", label = "Navigation") ) ), list( value = "component", label = "Component", children = list( list(value = "basic", label = "Basic"), list(value = "form", label = "Form", disabled = TRUE) ) ) ) if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_cascader( id = "cascader1", options = cascader_options, placeholder = "Please select", clearable = TRUE ), verbatimTextOutput("selected") ) server <- function(input, output, session) { output$selected <- renderPrint(input$cascader1) } shinyApp(ui, server) } # Advanced: custom props and update custom_props <- list( expandTrigger = "hover", multiple = FALSE, checkStrictly = FALSE, emitPath = TRUE, lazy = FALSE, value = "value", label = "label", children = "children" ) # Update cascader options in server: # update_el_cascader(session, "cascader1", options = new_options) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_cascader(session, "region", value = list("zj", "hz")) }) }
The panel of an el_cascader() on its own, always open: nested options in
side-by-side columns, for when there is room to show them rather than tuck
them into a dropdown.
el_cascader_panel( id = NULL, options = list(), value = NULL, props = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, height = NULL, item_size = NULL, virtual_scroll = NULL, width = NULL, slots = NULL, level_inputs = NULL, events = NULL, on = NULL, session = NULL ) update_el_cascader_panel( session = shiny::getDefaultReactiveDomain(), id, value = NULL, options = NULL, label = NULL, error = NULL, props = NULL, height = NULL, item_size = NULL, virtual_scroll = NULL )el_cascader_panel( id = NULL, options = list(), value = NULL, props = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, height = NULL, item_size = NULL, virtual_scroll = NULL, width = NULL, slots = NULL, level_inputs = NULL, events = NULL, on = NULL, session = NULL ) update_el_cascader_panel( session = shiny::getDefaultReactiveDomain(), id, value = NULL, options = NULL, label = NULL, error = NULL, props = NULL, height = NULL, item_size = NULL, virtual_scroll = NULL )
id |
Panel ID. Auto-generated if |
options |
Nested options, each |
value |
Initially selected path, as a vector of values from the top
level down – or a list of paths with |
props |
Element's |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
height |
Menu height for virtual scrolling (px). Element Plus's
|
item_size |
Node height for virtual scrolling (px). Element Plus's
|
virtual_scroll |
Whether to enable virtual scrolling for large data.
Element Plus's |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents. The default slot, scoped
with |
level_inputs |
Each level of the path as an input of its own:
input ids, one per level from the top. See |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the selected path |
input$<id>_lazy_load |
unasked | with props = list(lazy = TRUE), a column to load; answer with el_load_children() |
input$<id>_expand_change |
events = "expand_change" |
triggers when expand option changes |
input$<id>_close |
events = "close" |
close panel event, provided to Cascader to put away the panel judgment. |
The same list as el_events("el_cascader_panel"), which says how an event's arguments travel.
With level_inputs, each level of the path is an input too, as for
el_cascader().
Callable with call_el():
getCheckedNodes() – the selected options
clearCheckedNodes() – clear the selection
Server-side update for el_cascader_panel().
Every other argument of el_cascader_panel() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_cascader_panel() is called for its side effect and returns NULL invisibly.
regions <- list( list( value = "asia", label = "Asia", children = list( list(value = "cn", label = "China"), list(value = "jp", label = "Japan") ) ), list( value = "europe", label = "Europe", children = list( list(value = "fr", label = "France") ) ) ) el_cascader_panel("where", options = regions, value = c("asia", "jp")) # Several at once el_cascader_panel("where", options = regions, props = list(multiple = TRUE)) if (interactive()) { # inside a server function observeEvent( input$reset, update_el_cascader_panel(session, "where", value = list()) ) }regions <- list( list( value = "asia", label = "Asia", children = list( list(value = "cn", label = "China"), list(value = "jp", label = "Japan") ) ), list( value = "europe", label = "Europe", children = list( list(value = "fr", label = "France") ) ) ) el_cascader_panel("where", options = regions, value = c("asia", "jp")) # Several at once el_cascader_panel("where", options = regions, props = list(multiple = TRUE)) if (interactive()) { # inside a server function observeEvent( input$reset, update_el_cascader_panel(session, "where", value = list()) ) }
A tag that toggles on and off when clicked, as a checkbox does.
el_check_tag( id, label, value = FALSE, disabled = NULL, type = NULL, width = NULL, on = NULL ) update_el_check_tag( session = shiny::getDefaultReactiveDomain(), id, value = NULL, label = NULL, disabled = NULL, type = NULL )el_check_tag( id, label, value = FALSE, disabled = NULL, type = NULL, width = NULL, on = NULL ) update_el_check_tag( session = shiny::getDefaultReactiveDomain(), id, value = NULL, label = NULL, disabled = NULL, type = NULL )
id |
Tag ID; the state is reported as |
label |
The tag's text. |
value |
Whether it starts checked: Element Plus's |
disabled |
Whether it can be toggled. |
type |
|
width |
Component width, as a CSS unit. |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | TRUE while checked
|
The same list as el_events("el_check_tag"), which says how an event's arguments travel.
update_el_check_tag() changes the component from the server.
Every other argument of el_check_tag() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_check_tag() is called for its side effect and returns NULL invisibly.
el_check_tag("pinned", "Pinned", value = TRUE) el_check_tag("urgent", "Urgent", type = "danger") if (interactive()) { # inside a server function observeEvent( input$clear, update_el_check_tag(session, "pinned", value = FALSE) ) }el_check_tag("pinned", "Pinned", value = TRUE) el_check_tag("urgent", "Urgent", type = "danger") if (interactive()) { # inside a server function observeEvent( input$clear, update_el_check_tag(session, "pinned", value = FALSE) ) }
One box, ticked or not – Shiny's shiny::checkboxInput(), drawn by
Element. For several choices, el_checkbox_group().
el_checkbox( id = NULL, label = NULL, value = FALSE, indeterminate = NULL, disabled = NULL, border = NULL, size = NULL, true_label = NULL, false_label = NULL, name = NULL, checked = NULL, aria_controls = NULL, aria_label = NULL, controls = NULL, false_value = NULL, tabindex = NULL, true_value = NULL, validate_event = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_checkbox( session = shiny::getDefaultReactiveDomain(), id, value = NULL, label = NULL, indeterminate = NULL, disabled = NULL, border = NULL, size = NULL, true_label = NULL, false_label = NULL, name = NULL, checked = NULL, aria_controls = NULL, aria_label = NULL, controls = NULL, false_value = NULL, tabindex = NULL, true_value = NULL, validate_event = NULL )el_checkbox( id = NULL, label = NULL, value = FALSE, indeterminate = NULL, disabled = NULL, border = NULL, size = NULL, true_label = NULL, false_label = NULL, name = NULL, checked = NULL, aria_controls = NULL, aria_label = NULL, controls = NULL, false_value = NULL, tabindex = NULL, true_value = NULL, validate_event = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_checkbox( session = shiny::getDefaultReactiveDomain(), id, value = NULL, label = NULL, indeterminate = NULL, disabled = NULL, border = NULL, size = NULL, true_label = NULL, false_label = NULL, name = NULL, checked = NULL, aria_controls = NULL, aria_label = NULL, controls = NULL, false_value = NULL, tabindex = NULL, true_value = NULL, validate_event = NULL )
id |
Checkbox ID. Auto-generated if |
label |
The box's text, as for |
value |
Whether the box starts ticked. Default |
indeterminate |
Show the box half-ticked – the "check all" box
above a partly checked group. Only the look: |
disabled |
Whether the box is disabled. |
border |
Draw the box with a border. |
size |
Size: |
true_label, false_label
|
Values to report instead of |
name |
Native |
checked |
Element's |
aria_controls |
Same as aria-controls, takes effect when
|
aria_label |
Native |
controls |
Same as aria-controls, takes effect when |
false_value |
Value of the Checkbox if it's not checked. Element
Plus's |
tabindex |
Input tabindex. Element Plus's |
true_value |
Value of the Checkbox if it's checked. Element Plus's
|
validate_event |
Whether to trigger form validation. Element Plus's
|
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents; the default slot
replaces |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | TRUE or FALSE, or true_value and false_value
|
The same list as el_events("el_checkbox"), which says how an event's arguments travel.
Server-side update for el_checkbox().
Every other argument of el_checkbox() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_checkbox() is called for its side effect and returns NULL invisibly.
el_checkbox("agree", "I agree to the terms") # The "check all" box above a group el_checkbox("all", "Check all", indeterminate = TRUE) el_checkbox("remember", "Remember me", value = TRUE, border = TRUE) if (interactive()) { # inside a server function: the "check all" box follows the group observeEvent( input$cities, { n <- length(input$cities) update_el_checkbox( session, "all", value = n == 4, indeterminate = n > 0 && n < 4 ) }, ignoreNULL = FALSE ) }el_checkbox("agree", "I agree to the terms") # The "check all" box above a group el_checkbox("all", "Check all", indeterminate = TRUE) el_checkbox("remember", "Remember me", value = TRUE, border = TRUE) if (interactive()) { # inside a server function: the "check all" box follows the group observeEvent( input$cities, { n <- length(input$cities) update_el_checkbox( session, "all", value = n == 4, indeterminate = n > 0 && n < 4 ) }, ignoreNULL = FALSE ) }
Creates an Element Plus checkbox group with Vue instance, supporting individual checkboxes or button-style variants.
el_checkbox_group( id = NULL, choices = NULL, selected = NULL, disabled = FALSE, size = NULL, min = NULL, max = NULL, button = FALSE, fill = NULL, text_color = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, value = NULL, options = NULL, aria_label = NULL, props = NULL, tag = NULL, type = NULL, validate_event = NULL, on = NULL, session = NULL ) update_el_checkbox_group( session = shiny::getDefaultReactiveDomain(), id, selected = NULL, choices = NULL, disabled = NULL, min = NULL, max = NULL, value = NULL, options = NULL, label = NULL, error = NULL, size = NULL, fill = NULL, text_color = NULL, aria_label = NULL, props = NULL, tag = NULL, type = NULL, validate_event = NULL )el_checkbox_group( id = NULL, choices = NULL, selected = NULL, disabled = FALSE, size = NULL, min = NULL, max = NULL, button = FALSE, fill = NULL, text_color = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, value = NULL, options = NULL, aria_label = NULL, props = NULL, tag = NULL, type = NULL, validate_event = NULL, on = NULL, session = NULL ) update_el_checkbox_group( session = shiny::getDefaultReactiveDomain(), id, selected = NULL, choices = NULL, disabled = NULL, min = NULL, max = NULL, value = NULL, options = NULL, label = NULL, error = NULL, size = NULL, fill = NULL, text_color = NULL, aria_label = NULL, props = NULL, tag = NULL, type = NULL, validate_event = NULL )
id |
Checkbox group ID. Auto-generated UUID if |
choices, options
|
The choices: a named character vector
( |
selected, value
|
Character vector of initially checked values; none
by default. |
disabled |
Whether the entire group is disabled. Default |
size |
|
min |
Minimum number of checked items. |
max |
Maximum number of checked items. |
button |
Whether to use button-style checkboxes ( |
fill |
Border and background colour when |
text_color |
Text colour when |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
aria_label |
Native |
props |
Configuration options. Element Plus's |
tag |
Element tag of the checkbox group. Element Plus's |
type |
Component type to render options (e.g. |
validate_event |
Whether to trigger form validation. Element Plus's
|
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList with a Vue-managed checkbox group component.
| Input | Reported | Value |
input$<id> |
unasked | the values checked |
The same list as el_events("el_checkbox_group"), which says how an event's arguments travel.
Server-side update for el_checkbox_group(). Pass only the fields to change;
NULL fields are excluded from the update message.
Every other argument of el_checkbox_group() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_checkbox_group() is called for its side effect and returns NULL invisibly.
el_checkbox_group( "cb1", choices = c("Option A" = "a", "Option B" = "b") ) if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_checkbox_group( "cb1", choices = c("Apple" = "apple", "Banana" = "banana"), selected = "apple" ), verbatimTextOutput("selected") ) server <- function(input, output, session) { output$selected <- renderPrint(input$cb1) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_checkbox_group(session, "langs", selected = c("r", "py")) }) }el_checkbox_group( "cb1", choices = c("Option A" = "a", "Option B" = "b") ) if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_checkbox_group( "cb1", choices = c("Apple" = "apple", "Banana" = "banana"), selected = "apple" ), verbatimTextOutput("selected") ) server <- function(input, output, session) { output$selected <- renderPrint(input$cb1) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_checkbox_group(session, "langs", selected = c("r", "py")) }) }
Emits <div class="el-col el-col-N"> directly; see el_row() for why.
el_col( ..., span = 24, offset = NULL, push = NULL, pull = NULL, xs = NULL, sm = NULL, md = NULL, lg = NULL, xl = NULL, tag = "div", class = NULL, style = NULL )el_col( ..., span = 24, offset = NULL, push = NULL, pull = NULL, xs = NULL, sm = NULL, md = NULL, lg = NULL, xl = NULL, tag = "div", class = NULL, style = NULL )
... |
Column content. |
span |
Column span out of 24. Defaults to 24, as in Element Plus. |
offset |
Columns to offset by. |
push |
Columns to push right. |
pull |
Columns to pull left. |
xs, sm, md, lg, xl
|
Responsive spans. Either a number (the span) or a
list such as |
tag |
HTML element to render, as Element's |
class |
Extra CSS classes. |
style |
Extra inline style. |
A Shiny UI element.
el_col(span = 12, "half width") el_col(span = 6, offset = 6, "quarter, pushed right") el_col(xs = 24, sm = 12, md = 8, "responsive") el_col(md = list(span = 12, offset = 6), "responsive with offset")el_col(span = 12, "half width") el_col(span = 6, offset = 6, "quarter, pushed right") el_col(xs = 24, sm = 12, md = 8, "responsive") el_col(md = list(span = 12, offset = 6), "responsive with offset")
Collapsible panels. Several can be open at once unless accordion = TRUE.
el_collapse( id = NULL, items = list(), value = character(0), accordion = FALSE, expand_icon_position = "right", before_collapse = NULL, session = NULL ) update_el_collapse( session = shiny::getDefaultReactiveDomain(), id, value = NULL, accordion = NULL, expand_icon_position = NULL, before_collapse = NULL )el_collapse( id = NULL, items = list(), value = character(0), accordion = FALSE, expand_icon_position = "right", before_collapse = NULL, session = NULL ) update_el_collapse( session = shiny::getDefaultReactiveDomain(), id, value = NULL, accordion = NULL, expand_icon_position = NULL, before_collapse = NULL )
id |
Collapse ID. Auto-generated UUID if |
items |
A list of panels, each an
|
value |
Character vector of initially open panel names. In accordion mode only the first is used. |
accordion |
Single-open accordion mode. Default |
expand_icon_position |
Where each header's icon sits: |
before_collapse |
|
session |
In |
Rendered as plain markup carrying Element's own classes, driven by a Shiny
input binding rather than a Vue instance. That is what lets a panel hold
other components from this package: a Vue instance mounted here would
rebuild the DOM underneath them, detaching them from the server. See
.claude/docs/lessons.md.
An htmltools tag.
| Input | Reported | Value |
input$<id> |
unasked | the names of the open panels |
The same list as el_events("el_collapse"), which says how an event's arguments travel.
Server-side update for el_collapse(): the open panels, accordion,
expand_icon_position and before_collapse (NA for none).
update_el_collapse() is called for its side effect and returns NULL invisibly.
el_collapse( "col1", items = list( list(name = "p1", title = "Panel 1", content = shiny::tags$p("Content 1")), list(name = "p2", title = "Panel 2", content = shiny::tags$p("Content 2")) ), value = "p1" ) # A panel can hold other components el_collapse( "col2", items = list( list( name = "f", title = "Filters", content = shiny::tagList(el_input("q"), el_switch("live")) ) ) ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_collapse(session, "panels", value = "filters") }) }el_collapse( "col1", items = list( list(name = "p1", title = "Panel 1", content = shiny::tags$p("Content 1")), list(name = "p2", title = "Panel 2", content = shiny::tags$p("Content 2")) ), value = "p1" ) # A panel can hold other components el_collapse( "col2", items = list( list( name = "f", title = "Filters", content = shiny::tagList(el_input("q"), el_switch("live")) ) ) ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_collapse(session, "panels", value = "filters") }) }
el_collapse()
Element Plus's el-collapse-item, for el_collapse(items =).
el_collapse_item(title, ..., name = title, icon = NULL, disabled = NULL)el_collapse_item(title, ..., name = title, icon = NULL, disabled = NULL)
title |
Title of the panel. |
... |
The panel's content. |
name |
The panel's value, reported in |
icon |
The expand icon, by name (Element's default |
disabled |
Whether the panel is disabled. |
A panel, for el_collapse(items =).
Other items:
el_anchor_link(),
el_breadcrumb_item(),
el_carousel_item(),
el_descriptions_item(),
el_dropdown_item(),
el_menu_item(),
el_option(),
el_skeleton_item(),
el_step(),
el_tab_pane(),
el_table_column(),
el_table_v2_column(),
el_timeline_item(),
el_tour_step()
el_collapse( "c", items = list( el_collapse_item("Consistency", "Consistent with real life."), el_collapse_item("Feedback", "Operation feedback.", disabled = TRUE) ) )el_collapse( "c", items = list( el_collapse_item("Consistency", "Consistent with real life."), el_collapse_item("Feedback", "Operation feedback.", disabled = TRUE) ) )
A colour picker input that returns a CSS colour string.
el_color_picker( id = NULL, value = NULL, disabled = FALSE, size = NULL, show_alpha = FALSE, color_format = NULL, predefine = NULL, popper_class = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, append_to = NULL, aria_label = NULL, clearable = NULL, empty_values = NULL, persistent = NULL, popper_style = NULL, tabindex = NULL, teleported = NULL, validate_event = NULL, value_on_clear = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_color_picker( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, size = NULL, show_alpha = NULL, color_format = NULL, predefine = NULL, popper_class = NULL, append_to = NULL, aria_label = NULL, clearable = NULL, empty_values = NULL, persistent = NULL, popper_style = NULL, tabindex = NULL, teleported = NULL, validate_event = NULL, value_on_clear = NULL )el_color_picker( id = NULL, value = NULL, disabled = FALSE, size = NULL, show_alpha = FALSE, color_format = NULL, predefine = NULL, popper_class = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, append_to = NULL, aria_label = NULL, clearable = NULL, empty_values = NULL, persistent = NULL, popper_style = NULL, tabindex = NULL, teleported = NULL, validate_event = NULL, value_on_clear = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_color_picker( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, size = NULL, show_alpha = NULL, color_format = NULL, predefine = NULL, popper_class = NULL, append_to = NULL, aria_label = NULL, clearable = NULL, empty_values = NULL, persistent = NULL, popper_style = NULL, tabindex = NULL, teleported = NULL, validate_event = NULL, value_on_clear = NULL )
id |
Color picker ID. Auto-generated UUID if |
value |
Initial colour value (CSS hex/rgb string). |
disabled |
Whether the picker is disabled. Default |
size |
Size: |
show_alpha |
Whether to show an alpha channel slider. Default |
color_format |
Output format: |
predefine |
Character vector of preset colour swatches. |
popper_class |
Extra class name for the dropdown panel. |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
append_to |
Which element the color-picker panel appends to. Element
Plus's |
aria_label |
ColorPicker aria-label. Element Plus's |
clearable |
Whether to show clear button. Element Plus's |
empty_values |
Empty values of component, see config-provider. Element
Plus's |
persistent |
When color-picker inactive and persistent is false, the
color panel will be destroyed. Element Plus's |
popper_style |
Custom style for ColorPicker's dropdown. Element Plus's
|
tabindex |
ColorPicker tabindex. Element Plus's |
teleported |
Whether color-picker popper is teleported to the body.
Element Plus's |
validate_event |
Whether to trigger form validation. Element Plus's
|
value_on_clear |
Clear return value, see config-provider. Element
Plus's |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList with a Vue-managed color-picker component.
| Input | Reported | Value |
input$<id> |
unasked | the colour |
input$<id>_active_change |
events = "active_change" |
the colour being picked, at most every 200 ms |
input$<id>_blur |
events = "blur" |
triggers when Component blurs |
input$<id>_clear |
events = "clear" |
triggers when the clear button is clicked |
input$<id>_focus |
events = "focus" |
triggers when Component focuses |
The same list as el_events("el_color_picker"), which says how an event's arguments travel.
Server-side update for el_color_picker().
Every other argument of el_color_picker() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_color_picker() is called for its side effect and returns NULL invisibly.
el_color_picker("cp1", value = "#409EFF") el_color_picker("cp2", show_alpha = TRUE, predefine = c("#ff4500", "#ff8c00")) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_color_picker(session, "shade", value = "#67C23A") }) }el_color_picker("cp1", value = "#409EFF") el_color_picker("cp2", show_alpha = TRUE, predefine = c("#ff4500", "#ff8c00")) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_color_picker(session, "shade", value = "#67C23A") }) }
The colour picker's panel, always open, without the trigger.
el_color_picker_panel( id = NULL, value = NULL, border = NULL, disabled = NULL, show_alpha = NULL, color_format = NULL, predefine = NULL, validate_event = NULL, hue_slider_class = NULL, hue_slider_style = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, on = NULL ) update_el_color_picker_panel( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, border = NULL, show_alpha = NULL, color_format = NULL, predefine = NULL, validate_event = NULL, hue_slider_class = NULL, hue_slider_style = NULL )el_color_picker_panel( id = NULL, value = NULL, border = NULL, disabled = NULL, show_alpha = NULL, color_format = NULL, predefine = NULL, validate_event = NULL, hue_slider_class = NULL, hue_slider_style = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, on = NULL ) update_el_color_picker_panel( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, border = NULL, show_alpha = NULL, color_format = NULL, predefine = NULL, validate_event = NULL, hue_slider_class = NULL, hue_slider_style = NULL )
id |
Component ID. Auto-generated if |
value |
Binding value: Element Plus's |
border |
Whether the color picker panel is bordered. Element Plus's
|
disabled |
Whether to disable the color picker. Element Plus's
|
show_alpha |
Whether to display the alpha slider. Element Plus's
|
color_format |
Color format of v-model. Element Plus's |
predefine |
Predefined color options. Element Plus's |
validate_event |
Whether to trigger form validation. Element Plus's
|
hue_slider_class |
Class names will be passed to hue-slider. Element
Plus's |
hue_slider_style |
Styles will be passed to hue-slider. Element Plus's
|
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the colour |
The same list as el_events("el_color_picker_panel"), which says how an event's arguments travel.
Callable with call_el(): update().
Server-side update for el_color_picker_panel().
Every other argument of el_color_picker_panel() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_color_picker_panel() is called for its side effect and returns NULL invisibly.
el_color_picker_panel("brand", value = "#409EFF") if (interactive()) { # inside a server function observeEvent( input$reset, update_el_color_picker_panel(session, "x", value = NULL) ) }el_color_picker_panel("brand", value = "#409EFF") if (interactive()) { # inside a server function observeEvent( input$reset, update_el_color_picker_panel(session, "x", value = NULL) ) }
Settings for the components inside it: their size, the button and link defaults, the card's, the dialog's and message's, the empty values, and their language. The page's own – its locale, size, z-index – are el_page()'s.
el_config_provider( ..., id = NULL, locale = NULL, size = NULL, button = NULL, link = NULL, dialog = NULL, message = NULL, experimental_features = NULL, empty_values = NULL, value_on_clear = NULL, table = NULL, card = NULL, width = NULL, slots = NULL ) update_el_config_provider( session = shiny::getDefaultReactiveDomain(), id, locale = NULL, card = NULL, size = NULL, button = NULL, link = NULL, dialog = NULL, message = NULL, experimental_features = NULL, empty_values = NULL, value_on_clear = NULL, table = NULL )el_config_provider( ..., id = NULL, locale = NULL, size = NULL, button = NULL, link = NULL, dialog = NULL, message = NULL, experimental_features = NULL, empty_values = NULL, value_on_clear = NULL, table = NULL, card = NULL, width = NULL, slots = NULL ) update_el_config_provider( session = shiny::getDefaultReactiveDomain(), id, locale = NULL, card = NULL, size = NULL, button = NULL, link = NULL, dialog = NULL, message = NULL, experimental_features = NULL, empty_values = NULL, value_on_clear = NULL, table = NULL )
... |
Its content: any Shiny UI. Components of this package are folded
into this one's Vue instance, as |
id |
Component ID. Auto-generated if |
locale |
The language of the components inside it, as
|
size |
Global component size. Element Plus's |
button |
Button related configuration, see the following table.
Element Plus's |
link |
Link related configuration, see the following table. Element
Plus's |
dialog |
Dialog related configuration, see the following table.
Element Plus's |
message |
Message related configuration, see the following table.
Element Plus's |
experimental_features |
Features at experimental stage to be added,
all features are default to be set to false. Element Plus's
|
empty_values |
Global empty values of components. Element Plus's
|
value_on_clear |
Global clear return value. Element Plus's
|
table |
Table related configuration, see the following table. Element
Plus's |
card |
Card related configuration: |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents. A scoped slot is written
with |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
None: it reports nothing.
update_el_config_provider() changes the component from the server: every argument of
el_config_provider() that can change once it is drawn, under the same name. One left
NULL stays as it is; NA returns it to Element's default.
update_el_config_provider() is called for its side effect and returns NULL invisibly.
el_config_provider( size = "small", button = list(autoInsertSpace = TRUE), el_button("a", "OK"), el_input("b") )el_config_provider( size = "small", button = list(autoInsertSpace = TRUE), el_button("a", "OK"), el_input("b") )
Emits <section class="el-container"> directly, as Element does.
el_container( ..., id = NULL, direction = NULL, style = NULL, class = NULL, session = NULL )el_container( ..., id = NULL, direction = NULL, style = NULL, class = NULL, session = NULL )
... |
Child components, typically |
id |
Optional container id. |
direction |
|
style |
Extra inline style. |
class |
Extra CSS classes. |
session |
Deprecated. Inside a module, wrap |
Element's container styles are plain CSS, so no Vue instance is needed – and none is wanted: one mounted over the container would recompile the components placed inside it and detach them.
A Shiny UI element.
# Header above a sidebar and main area el_container( el_header("Title"), el_container( el_aside(width = "200px", "Sidebar"), el_main("Content") ) ) # Nested inputs work, unlike with the previous Vue template approach el_container( el_header(el_switch("dark_mode", value = FALSE)), el_main(el_slider("amount", value = 50)) )# Header above a sidebar and main area el_container( el_header("Title"), el_container( el_aside(width = "200px", "Sidebar"), el_main("Content") ) ) # Nested inputs work, unlike with the previous Vue template approach el_container( el_header(el_switch("dark_mode", value = FALSE)), el_main(el_slider("amount", value = 50)) )
Creates an Element Plus date picker with Vue instance, supporting single date, datetime, month, year, week, and date range selection modes.
el_date_picker( id = NULL, value = NULL, type = "date", value_format = NULL, format = NULL, placeholder = NULL, start_placeholder = NULL, end_placeholder = NULL, clearable = TRUE, disabled = FALSE, editable = TRUE, readonly = FALSE, range_separator = "-", size = NULL, name = NULL, prefix_icon = NULL, clear_icon = NULL, popper_class = NULL, default_value = NULL, default_time = NULL, unlink_panels = NULL, validate_event = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, arrow_control = NULL, automatic_dropdown = NULL, cell_class_name = NULL, date_format = NULL, disabled_date = NULL, disabled_hours = NULL, disabled_minutes = NULL, disabled_seconds = NULL, empty_values = NULL, fallback_placements = NULL, placement = NULL, popper_options = NULL, popper_style = NULL, shortcuts = NULL, show_confirm = NULL, show_footer = NULL, show_now = NULL, show_week_number = NULL, single_panel = NULL, teleported = NULL, time_format = NULL, value_on_clear = NULL, events = NULL, on = NULL, session = NULL ) update_el_date_picker( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, type = NULL, clearable = NULL, readonly = NULL, placeholder = NULL, label = NULL, error = NULL, value_format = NULL, format = NULL, start_placeholder = NULL, end_placeholder = NULL, editable = NULL, range_separator = NULL, size = NULL, name = NULL, prefix_icon = NULL, clear_icon = NULL, popper_class = NULL, unlink_panels = NULL, validate_event = NULL, arrow_control = NULL, automatic_dropdown = NULL, cell_class_name = NULL, date_format = NULL, disabled_date = NULL, disabled_hours = NULL, disabled_minutes = NULL, disabled_seconds = NULL, empty_values = NULL, fallback_placements = NULL, placement = NULL, popper_options = NULL, popper_style = NULL, shortcuts = NULL, show_confirm = NULL, show_footer = NULL, show_now = NULL, show_week_number = NULL, single_panel = NULL, teleported = NULL, time_format = NULL, value_on_clear = NULL )el_date_picker( id = NULL, value = NULL, type = "date", value_format = NULL, format = NULL, placeholder = NULL, start_placeholder = NULL, end_placeholder = NULL, clearable = TRUE, disabled = FALSE, editable = TRUE, readonly = FALSE, range_separator = "-", size = NULL, name = NULL, prefix_icon = NULL, clear_icon = NULL, popper_class = NULL, default_value = NULL, default_time = NULL, unlink_panels = NULL, validate_event = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, arrow_control = NULL, automatic_dropdown = NULL, cell_class_name = NULL, date_format = NULL, disabled_date = NULL, disabled_hours = NULL, disabled_minutes = NULL, disabled_seconds = NULL, empty_values = NULL, fallback_placements = NULL, placement = NULL, popper_options = NULL, popper_style = NULL, shortcuts = NULL, show_confirm = NULL, show_footer = NULL, show_now = NULL, show_week_number = NULL, single_panel = NULL, teleported = NULL, time_format = NULL, value_on_clear = NULL, events = NULL, on = NULL, session = NULL ) update_el_date_picker( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, type = NULL, clearable = NULL, readonly = NULL, placeholder = NULL, label = NULL, error = NULL, value_format = NULL, format = NULL, start_placeholder = NULL, end_placeholder = NULL, editable = NULL, range_separator = NULL, size = NULL, name = NULL, prefix_icon = NULL, clear_icon = NULL, popper_class = NULL, unlink_panels = NULL, validate_event = NULL, arrow_control = NULL, automatic_dropdown = NULL, cell_class_name = NULL, date_format = NULL, disabled_date = NULL, disabled_hours = NULL, disabled_minutes = NULL, disabled_seconds = NULL, empty_values = NULL, fallback_placements = NULL, placement = NULL, popper_options = NULL, popper_style = NULL, shortcuts = NULL, show_confirm = NULL, show_footer = NULL, show_now = NULL, show_week_number = NULL, single_panel = NULL, teleported = NULL, time_format = NULL, value_on_clear = NULL )
id |
Date picker ID. Auto-generated UUID if |
value |
Initial value. A |
type |
Picker type: |
value_format |
Format string returned to Shiny when a date is selected,
in day.js's tokens, as Element Plus takes it (e.g., |
format |
Display format shown in the input box, in day.js's tokens.
|
placeholder |
Placeholder text for non-range types. |
start_placeholder |
Placeholder for the start input in range types. |
end_placeholder |
Placeholder for the end input in range types. |
clearable |
Whether to show the clear button. Default |
disabled |
Whether the picker is disabled. Default |
editable |
Whether the user can type directly in the input. Default |
readonly |
Whether the picker is read-only. Default |
range_separator |
Separator string displayed between start and end in
range types. Default |
size |
Size: |
name |
Native |
prefix_icon |
Icon class shown at the start of the input. |
clear_icon |
Icon class of the clear button. |
popper_class |
Extra class name for the picker panel. |
default_value |
Date the panel opens on when nothing is selected. |
default_time |
Time part used when a date is picked, as |
unlink_panels |
Whether the two panels of a range picker move independently. |
validate_event |
Whether a change triggers form validation. Default |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
arrow_control |
Whether to pick time using arrow buttons. Element
Plus's |
automatic_dropdown |
This prop decides if the date picker panel pops
up when the input is focused. (The default value will be set to false in
version 3.0). Element Plus's |
cell_class_name |
Set custom className. Element Plus's
|
date_format |
Optional, format of the date displayed in input's inner
panel. Element Plus's |
disabled_date |
A function determining if a date is disabled with that
date as its parameter. Should return a Boolean. Element Plus's
|
disabled_hours |
To specify the array of hours that cannot be
selected. Element Plus's |
disabled_minutes |
To specify the array of minutes that cannot be
selected. Element Plus's |
disabled_seconds |
To specify the array of seconds that cannot be
selected. Element Plus's |
empty_values |
Empty values of component, see config-provider. Element
Plus's |
fallback_placements |
List of possible positions for Tooltip
popper.js. Element Plus's |
placement |
Position of dropdown. Element Plus's |
popper_options |
Customized popper option see more at popper.js.
Element Plus's |
popper_style |
Custom style for DatePicker's dropdown. Element Plus's
|
shortcuts |
An object array to set shortcut options. Element Plus's
|
show_confirm |
Whether to show the confirm button. Element Plus's
|
show_footer |
Whether to show footer where the date picker is one
|
show_now |
Whether to show the now button. Element Plus's |
show_week_number |
Show the week number besides the week. Element
Plus's |
single_panel |
Show only one panel in range-picker. Element Plus's
|
teleported |
Whether date-picker dropdown is teleported to the body.
Element Plus's |
time_format |
Optional, format of the time displayed in input's inner
panel. Element Plus's |
value_on_clear |
Clear return value, see config-provider. Element
Plus's |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList with a Vue-managed date picker component.
Callable with call_el():
focus() – Focus the Input component
| Input | Reported | Value |
input$<id> |
unasked | the date, two for a range |
input$<id>_blur |
events = "blur" |
triggers when Input blurs |
input$<id>_focus |
events = "focus" |
triggers when Input focuses |
input$<id>_calendar_change |
events = "calendar_change" |
triggers when the calendar selected date is changed. Only for range |
input$<id>_clear |
events = "clear" |
triggers when a clear button is clicked |
input$<id>_panel_change |
events = "panel_change" |
triggers when the navigation button click. |
input$<id>_visible_change |
events = "visible_change" |
triggers when the DatePicker's dropdown appears/disappears |
The same list as el_events("el_date_picker"), which says how an event's arguments travel.
For type "date", "dates" and "daterange" with the default
value_format, input$<id> is a Date (two for a range, several for
"dates"), as shiny::dateInput() gives one; NULL while empty. Any
other type or value_format reports the text the picker produces, in
that format – you asked for that format, so it is not converted.
Server-side update for el_date_picker(). Supports updating value, disabled
state, type, clearable, readonly, and placeholder text.
Every other argument of el_date_picker() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_date_picker() is called for its side effect and returns NULL invisibly.
# Basic date picker el_date_picker("dp1") # Pre-filled with today's date el_date_picker("dp2", value = Sys.Date()) # Date range picker el_date_picker( "dp3", type = "daterange", start_placeholder = "Start date", end_placeholder = "End date" ) # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_date_picker("dp1", placeholder = "Pick a date"), verbatimTextOutput("selected") ) server <- function(input, output, session) { output$selected <- renderPrint(input$dp1) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_date_picker(session, "when", value = "2026-06-01") }) }# Basic date picker el_date_picker("dp1") # Pre-filled with today's date el_date_picker("dp2", value = Sys.Date()) # Date range picker el_date_picker( "dp3", type = "daterange", start_placeholder = "Start date", end_placeholder = "End date" ) # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_date_picker("dp1", placeholder = "Pick a date"), verbatimTextOutput("selected") ) server <- function(input, output, session) { output$selected <- renderPrint(input$dp1) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_date_picker(session, "when", value = "2026-06-01") }) }
The date picker's panel, always open, without the input.
el_date_picker_panel( id = NULL, value = NULL, border = NULL, disabled = NULL, clearable = NULL, editable = NULL, type = NULL, default_value = NULL, default_time = NULL, value_format = NULL, date_format = NULL, time_format = NULL, unlink_panels = NULL, single_panel = NULL, disabled_date = NULL, shortcuts = NULL, cell_class_name = NULL, show_footer = NULL, show_confirm = NULL, show_week_number = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_date_picker_panel( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, border = NULL, clearable = NULL, editable = NULL, type = NULL, value_format = NULL, date_format = NULL, time_format = NULL, unlink_panels = NULL, single_panel = NULL, disabled_date = NULL, shortcuts = NULL, cell_class_name = NULL, show_footer = NULL, show_confirm = NULL, show_week_number = NULL )el_date_picker_panel( id = NULL, value = NULL, border = NULL, disabled = NULL, clearable = NULL, editable = NULL, type = NULL, default_value = NULL, default_time = NULL, value_format = NULL, date_format = NULL, time_format = NULL, unlink_panels = NULL, single_panel = NULL, disabled_date = NULL, shortcuts = NULL, cell_class_name = NULL, show_footer = NULL, show_confirm = NULL, show_week_number = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_date_picker_panel( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, border = NULL, clearable = NULL, editable = NULL, type = NULL, value_format = NULL, date_format = NULL, time_format = NULL, unlink_panels = NULL, single_panel = NULL, disabled_date = NULL, shortcuts = NULL, cell_class_name = NULL, show_footer = NULL, show_confirm = NULL, show_week_number = NULL )
id |
Component ID. Auto-generated if |
value |
Binding value, if it is an |
border |
Whether the date picker is bordered. Element Plus's |
disabled |
Whether DatePicker is disabled. Element Plus's |
clearable |
Whether to show clear button. Element Plus's |
editable |
Whether the input is editable. Element Plus's |
type |
Type of the picker. |
default_value |
Optional, default date of the calendar. Element Plus's
|
default_time |
Optional, the time value to use when selecting date
range. Element Plus's |
value_format |
Optional, format of binding value. If not specified,
the binding value will be a Date object. Element Plus's |
date_format |
Optional, format of the date displayed in input's inner
panel. Element Plus's |
time_format |
Optional, format of the time displayed in input's inner
panel. Element Plus's |
unlink_panels |
Unlink two date-panels in range-picker. Element Plus's
|
single_panel |
Show only one panel in range-picker. Element Plus's
|
disabled_date |
A function determining if a date is disabled with that
date as its parameter. Should return a Boolean. Element Plus's
|
shortcuts |
An object array to set shortcut options. Element Plus's
|
cell_class_name |
Set custom className. Element Plus's
|
show_footer |
Whether to show footer where the date picker is one
|
show_confirm |
Whether to show the confirm button. Element Plus's
|
show_week_number |
Show the week number besides the week. Element
Plus's |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents: |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the date, two for a range |
input$<id>_calendar_change |
events = "calendar_change" |
triggers when the calendar selected date is changed. Only for range |
input$<id>_panel_change |
events = "panel_change" |
triggers when the navigation button click. |
input$<id>_clear |
events = "clear" |
triggers when a clear button is clicked |
The same list as el_events("el_date_picker_panel"), which says how an event's arguments travel.
Server-side update for el_date_picker_panel().
Every other argument of el_date_picker_panel() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_date_picker_panel() is called for its side effect and returns NULL invisibly.
el_date_picker_panel("day", value = Sys.Date(), value_format = "YYYY-MM-DD") if (interactive()) { # inside a server function observeEvent( input$reset, update_el_date_picker_panel(session, "x", value = NULL) ) }el_date_picker_panel("day", value = Sys.Date(), value_format = "YYYY-MM-DD") if (interactive()) { # inside a server function observeEvent( input$reset, update_el_date_picker_panel(session, "x", value = NULL) ) }
A read-only grid of labelled values – the detail view of a record.
el_descriptions( id = NULL, items = list(), title = NULL, extra = NULL, column = NULL, direction = NULL, border = NULL, size = NULL, label_width = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_descriptions( session = shiny::getDefaultReactiveDomain(), id, title = NULL, extra = NULL, column = NULL, direction = NULL, border = NULL, size = NULL, label_width = NULL )el_descriptions( id = NULL, items = list(), title = NULL, extra = NULL, column = NULL, direction = NULL, border = NULL, size = NULL, label_width = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_descriptions( session = shiny::getDefaultReactiveDomain(), id, title = NULL, extra = NULL, column = NULL, direction = NULL, border = NULL, size = NULL, label_width = NULL )
id |
Component ID. Auto-generated if |
items |
The fields, each an |
title |
Heading above the grid. |
extra |
Text at the heading's right end. For something interactive,
use |
column |
Items per row. Default |
direction |
|
border |
Whether to draw cell borders. |
size |
Size: |
label_width |
Label width of every column. Element Plus's
|
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
Server-side update for el_descriptions(). The items themselves are
markup, so replace them by re-rendering; this changes the settings around
them.
update_el_descriptions() is called for its side effect and returns NULL invisibly.
el_descriptions( "user", title = "Account", border = TRUE, items = list( list(label = "Name", content = "Ada Lovelace"), list(label = "Plan", content = el_tag("plan", "Pro", type = "success")), list(label = "Address", content = "12 St James's Square, London", span = 2) ) ) # The quick form: names are labels el_descriptions("car", items = as.list(mtcars[1, 1:6])) if (interactive()) { # inside a server function observeEvent(input$narrow, { update_el_descriptions(session, "user", column = 1) }) }el_descriptions( "user", title = "Account", border = TRUE, items = list( list(label = "Name", content = "Ada Lovelace"), list(label = "Plan", content = el_tag("plan", "Pro", type = "success")), list(label = "Address", content = "12 St James's Square, London", span = 2) ) ) # The quick form: names are labels el_descriptions("car", items = as.list(mtcars[1, 1:6])) if (interactive()) { # inside a server function observeEvent(input$narrow, { update_el_descriptions(session, "user", column = 1) }) }
el_descriptions()
Element Plus's el-descriptions-item, for el_descriptions(items =).
el_descriptions_item( label, ..., span = NULL, rowspan = NULL, width = NULL, min_width = NULL, label_width = NULL, align = NULL, label_align = NULL, class_name = NULL, label_class_name = NULL )el_descriptions_item( label, ..., span = NULL, rowspan = NULL, width = NULL, min_width = NULL, label_width = NULL, align = NULL, label_align = NULL, class_name = NULL, label_class_name = NULL )
label |
Label text, or markup for the item's label slot. |
... |
The field's content: text, tags, this package's components. |
span |
Number of columns the field spans. |
rowspan |
Number of rows the field spans. |
width |
Column width; the widest in a column wins. Without a border it includes the label. |
min_width |
Minimum column width; columns with |
label_width |
Width of the label, over the descriptions' own. |
align |
Content alignment: |
label_align |
Label alignment, |
class_name |
Class of the content cell. |
label_class_name |
Class of the label cell. |
A field, for el_descriptions(items =).
Other items:
el_anchor_link(),
el_breadcrumb_item(),
el_carousel_item(),
el_collapse_item(),
el_dropdown_item(),
el_menu_item(),
el_option(),
el_skeleton_item(),
el_step(),
el_tab_pane(),
el_table_column(),
el_table_v2_column(),
el_timeline_item(),
el_tour_step()
el_descriptions( "d", items = list( el_descriptions_item("Username", "kooriookami"), el_descriptions_item("Address", "No.1188, Wuzhong Avenue", span = 2) ) )el_descriptions( "d", items = list( el_descriptions_item("Username", "kooriookami"), el_descriptions_item("Address", "No.1188, Wuzhong Avenue", span = 2) ) )
A modal dialog.
el_dialog( id = NULL, title = "", content = NULL, footer = NULL, visible = FALSE, width = "50%", top = "15vh", fullscreen = FALSE, modal = TRUE, close_on_click_modal = TRUE, close_on_press_escape = TRUE, show_close = TRUE, center = FALSE, lock_scroll = TRUE, custom_class = NULL, append_to_body = FALSE, destroy_on_close = FALSE, before_close = NULL, modal_penetrable = FALSE, close_icon = NULL, align_center = NULL, draggable = NULL, overflow = NULL, modal_class = NULL, header_class = NULL, body_class = NULL, footer_class = NULL, append_to = NULL, open_delay = NULL, close_delay = NULL, z_index = NULL, header_aria_level = "2", transition = NULL, events = NULL, session = NULL ) update_el_dialog( session = shiny::getDefaultReactiveDomain(), id, visible = NULL, title = NULL, width = NULL, top = NULL, fullscreen = NULL, modal = NULL, close_on_click_modal = NULL, close_on_press_escape = NULL, show_close = NULL, center = NULL, lock_scroll = NULL, draggable = NULL, overflow = NULL, align_center = NULL )el_dialog( id = NULL, title = "", content = NULL, footer = NULL, visible = FALSE, width = "50%", top = "15vh", fullscreen = FALSE, modal = TRUE, close_on_click_modal = TRUE, close_on_press_escape = TRUE, show_close = TRUE, center = FALSE, lock_scroll = TRUE, custom_class = NULL, append_to_body = FALSE, destroy_on_close = FALSE, before_close = NULL, modal_penetrable = FALSE, close_icon = NULL, align_center = NULL, draggable = NULL, overflow = NULL, modal_class = NULL, header_class = NULL, body_class = NULL, footer_class = NULL, append_to = NULL, open_delay = NULL, close_delay = NULL, z_index = NULL, header_aria_level = "2", transition = NULL, events = NULL, session = NULL ) update_el_dialog( session = shiny::getDefaultReactiveDomain(), id, visible = NULL, title = NULL, width = NULL, top = NULL, fullscreen = NULL, modal = NULL, close_on_click_modal = NULL, close_on_press_escape = NULL, show_close = NULL, center = NULL, lock_scroll = NULL, draggable = NULL, overflow = NULL, align_center = NULL )
id |
Dialog ID. Auto-generated UUID if |
title |
Header text. |
content |
Dialog body. Any tag or tagList, including this package's own components. |
footer |
Footer content, usually buttons. |
visible |
Whether it starts open: Element Plus's |
width |
Dialog width, e.g. |
top |
Distance from the top of the viewport. Ignored when
|
fullscreen |
Fill the viewport. |
modal |
Show the backdrop. |
close_on_click_modal |
Close when the backdrop is clicked. |
close_on_press_escape |
Close on Escape. |
show_close |
Show the close button in the header. |
center |
Centre the header and footer. |
lock_scroll |
Whether the page stops scrolling while it is open. |
custom_class |
Extra class name for the panel. |
append_to_body |
|
destroy_on_close |
Re-create the content each time it opens, and remove it when it closes: inputs inside start from their initial values again. |
before_close |
|
modal_penetrable |
Let clicks through the backdrop to the page
beneath, when |
close_icon |
The close button's icon, by name. Default |
align_center |
Centre the dialog in the viewport, vertically too. |
draggable |
Let the dialog be dragged by its header. |
overflow |
With |
modal_class, header_class, body_class, footer_class
|
Extra class names for the backdrop, the header, the body and the footer. |
append_to |
A CSS selector for where the overlay goes when it opens,
so a container's |
open_delay, close_delay
|
Milliseconds to wait before opening and closing. |
z_index |
The overlay's z-index, instead of the next one Element Plus hands out. |
header_aria_level |
The title's |
transition |
The name of the transition it plays, instead of
Element's |
events |
Element's events to report besides those reported unasked,
by name: |
session |
In |
Rendered as plain markup carrying Element Plus's own classes, driven by a Shiny input binding rather than a Vue instance, so the body can hold other components from this package.
An htmltools tag.
| Input | Reported | Value |
input$<id> |
unasked | TRUE while it is open |
input$<id>_open |
events = "open" |
triggers when the Dialog opens |
input$<id>_opened |
events = "opened" |
triggers when the Dialog opening animation ends |
input$<id>_close |
events = "close" |
triggers when the Dialog closes |
input$<id>_closed |
unasked | triggers when the Dialog closing animation ends |
input$<id>_open_auto_focus |
events = "open_auto_focus" |
triggers after Dialog opens and content focused |
input$<id>_close_auto_focus |
events = "close_auto_focus" |
triggers after Dialog closed and content focused |
The same list as el_events("el_dialog"), which says how an event's arguments travel.
Shiny routes an input binding's messages by element id, so the value is
input$<id> itself, as for el_tabs() and el_collapse().
Callable with call_el(): resetPosition() puts a dragged dialog back.
Server-side update for el_dialog(): whether it shows, its title and
width, and how it looks and behaves – top, fullscreen, modal,
close_on_click_modal, close_on_press_escape, show_close, center,
lock_scroll, draggable, overflow, align_center – as Element's
props, reactive there.
update_el_dialog() is called for its side effect and returns NULL invisibly.
el_dialog( "d1", title = "Confirm", content = shiny::tags$p("Are you sure?"), footer = el_button("ok", "OK", type = "primary") ) # The body can hold other components el_dialog( "d2", title = "Filters", draggable = TRUE, content = shiny::tagList(el_input("q"), el_switch("live")) ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_dialog(session, "confirm", visible = TRUE) }) }el_dialog( "d1", title = "Confirm", content = shiny::tags$p("Are you sure?"), footer = el_button("ok", "OK", type = "primary") ) # The body can hold other components el_dialog( "d2", title = "Filters", draggable = TRUE, content = shiny::tagList(el_input("q"), el_switch("live")) ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_dialog(session, "confirm", visible = TRUE) }) }
Renders a horizontal or vertical dividing line, optionally with inline text.
el_divider( content = NULL, direction = "horizontal", content_position = "center", border_style = "solid", class = NULL, style = NULL )el_divider( content = NULL, direction = "horizontal", content_position = "center", border_style = "solid", class = NULL, style = NULL )
content |
Optional text/tag placed inside the divider. Only for
|
direction |
Divider orientation: |
content_position |
Position of inline text when |
border_style |
The line's style, as CSS |
class, style
|
Extra classes and inline style, as Element passes them
to its root – |
An htmltools tag.
el_divider() el_divider("Title Text", content_position = "left") el_divider(direction = "vertical")el_divider() el_divider("Title Text", content_position = "left") el_divider(direction = "vertical")
A panel that slides in from an edge of the viewport.
el_drawer( id = NULL, title = "", content = NULL, visible = FALSE, direction = "rtl", size = "30%", modal = TRUE, with_header = TRUE, show_close = TRUE, close_on_press_escape = TRUE, custom_class = NULL, append_to_body = FALSE, destroy_on_close = FALSE, before_close = NULL, footer = NULL, resizable = FALSE, modal_penetrable = FALSE, close_on_click_modal = TRUE, lock_scroll = TRUE, modal_class = NULL, header_class = NULL, body_class = NULL, footer_class = NULL, append_to = NULL, open_delay = NULL, close_delay = NULL, z_index = NULL, header_aria_level = "2", events = NULL, session = NULL ) update_el_drawer( session = shiny::getDefaultReactiveDomain(), id, visible = NULL, title = NULL, size = NULL, direction = NULL, modal = NULL, with_header = NULL, show_close = NULL, close_on_click_modal = NULL, close_on_press_escape = NULL, lock_scroll = NULL )el_drawer( id = NULL, title = "", content = NULL, visible = FALSE, direction = "rtl", size = "30%", modal = TRUE, with_header = TRUE, show_close = TRUE, close_on_press_escape = TRUE, custom_class = NULL, append_to_body = FALSE, destroy_on_close = FALSE, before_close = NULL, footer = NULL, resizable = FALSE, modal_penetrable = FALSE, close_on_click_modal = TRUE, lock_scroll = TRUE, modal_class = NULL, header_class = NULL, body_class = NULL, footer_class = NULL, append_to = NULL, open_delay = NULL, close_delay = NULL, z_index = NULL, header_aria_level = "2", events = NULL, session = NULL ) update_el_drawer( session = shiny::getDefaultReactiveDomain(), id, visible = NULL, title = NULL, size = NULL, direction = NULL, modal = NULL, with_header = NULL, show_close = NULL, close_on_click_modal = NULL, close_on_press_escape = NULL, lock_scroll = NULL )
id |
Drawer ID. Auto-generated UUID if |
title |
Header text. |
content |
Drawer body. Any tag or tagList, including this package's own components. |
visible |
Whether it starts open: Element Plus's |
direction |
Edge it slides from: |
size |
Width for a horizontal drawer, height for a vertical one. |
modal |
Show the backdrop. |
with_header |
Show the header bar. |
show_close |
Show the close button in the header. |
close_on_press_escape |
Close on Escape. |
custom_class |
Extra class name for the panel. |
append_to_body |
|
destroy_on_close |
Re-create the content each time it opens, and remove it when it closes: inputs inside start from their initial values again. |
before_close |
|
footer |
Footer content, usually buttons. |
resizable |
Let the drawer be resized by dragging its inner edge. |
modal_penetrable |
Let clicks through the backdrop to the page
beneath, when |
close_on_click_modal |
Close when the backdrop is clicked. (Element
UI's |
lock_scroll |
Whether the page stops scrolling while it is open. |
modal_class, header_class, body_class, footer_class
|
Extra class names for the backdrop, the header, the body and the footer. |
append_to |
A CSS selector for where the overlay goes when it opens,
so a container's |
open_delay, close_delay
|
Milliseconds to wait before opening and closing. |
z_index |
The overlay's z-index, instead of the next one Element Plus hands out. |
header_aria_level |
The title's |
events |
Element's events to report besides those reported unasked,
by name: |
session |
In |
Rendered as plain markup carrying Element Plus's own classes, driven by a Shiny input binding rather than a Vue instance, so the body can hold other components from this package.
An htmltools tag.
| Input | Reported | Value |
input$<id> |
unasked | TRUE while it is open |
input$<id>_open |
events = "open" |
Triggered before Drawer opening animation begins |
input$<id>_opened |
events = "opened" |
Triggered after Drawer opening animation ended |
input$<id>_close |
events = "close" |
Triggered before Drawer closing animation begins |
input$<id>_closed |
unasked | Triggered after Drawer closing animation ended |
input$<id>_open_auto_focus |
events = "open_auto_focus" |
triggers after Drawer opens and content focused |
input$<id>_close_auto_focus |
events = "close_auto_focus" |
triggers after Drawer closed and content focused |
input$<id>_resize_start |
events = "resize_start" |
the size, in pixels |
input$<id>_resize |
events = "resize" |
the size, in pixels |
input$<id>_resize_end |
events = "resize_end" |
the size, in pixels |
The same list as el_events("el_drawer"), which says how an event's arguments travel.
Callable with call_el(): handleClose() closes it the way the user
would, through before_close (closeDrawer(), Element UI's name, too).
Server-side update for el_drawer(): whether it shows, its title, its
size, the edge it slides from (direction), and how it behaves – modal,
with_header, show_close, close_on_click_modal,
close_on_press_escape, lock_scroll – as Element's props, reactive
there.
update_el_drawer() is called for its side effect and returns NULL invisibly.
el_drawer("w1", title = "Settings", content = shiny::tags$p("Body")) # Sliding up from the bottom, holding other components el_drawer( "w2", title = "Filters", direction = "btt", size = "40%", content = shiny::tagList(el_input("q"), el_switch("live")) ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_drawer(session, "settings", visible = TRUE) }) }el_drawer("w1", title = "Settings", content = shiny::tags$p("Body")) # Sliding up from the bottom, holding other components el_drawer( "w2", title = "Filters", direction = "btt", size = "40%", content = shiny::tagList(el_input("q"), el_switch("live")) ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_drawer(session, "settings", visible = TRUE) }) }
A dropdown menu triggered by hover or click. Each menu item fires a command that is reported as a Shiny input.
el_dropdown( id = NULL, trigger_label = "Dropdown", items = list(), trigger = "hover", type = NULL, size = NULL, split_button = FALSE, hide_on_click = TRUE, placement = "bottom-end", disabled = FALSE, show_timeout = NULL, hide_timeout = NULL, tabindex = NULL, append_to = NULL, button_props = NULL, effect = NULL, max_height = NULL, persistent = NULL, popper_class = NULL, popper_options = NULL, popper_style = NULL, role = NULL, show_arrow = NULL, teleported = NULL, trigger_keys = NULL, virtual_ref = NULL, virtual_triggering = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_dropdown( session = shiny::getDefaultReactiveDomain(), id, disabled = NULL, trigger = NULL, type = NULL, size = NULL, split_button = NULL, hide_on_click = NULL, placement = NULL, show_timeout = NULL, hide_timeout = NULL, tabindex = NULL, append_to = NULL, button_props = NULL, effect = NULL, max_height = NULL, persistent = NULL, popper_class = NULL, popper_options = NULL, popper_style = NULL, role = NULL, show_arrow = NULL, teleported = NULL, trigger_keys = NULL, virtual_ref = NULL, virtual_triggering = NULL )el_dropdown( id = NULL, trigger_label = "Dropdown", items = list(), trigger = "hover", type = NULL, size = NULL, split_button = FALSE, hide_on_click = TRUE, placement = "bottom-end", disabled = FALSE, show_timeout = NULL, hide_timeout = NULL, tabindex = NULL, append_to = NULL, button_props = NULL, effect = NULL, max_height = NULL, persistent = NULL, popper_class = NULL, popper_options = NULL, popper_style = NULL, role = NULL, show_arrow = NULL, teleported = NULL, trigger_keys = NULL, virtual_ref = NULL, virtual_triggering = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_dropdown( session = shiny::getDefaultReactiveDomain(), id, disabled = NULL, trigger = NULL, type = NULL, size = NULL, split_button = NULL, hide_on_click = NULL, placement = NULL, show_timeout = NULL, hide_timeout = NULL, tabindex = NULL, append_to = NULL, button_props = NULL, effect = NULL, max_height = NULL, persistent = NULL, popper_class = NULL, popper_options = NULL, popper_style = NULL, role = NULL, show_arrow = NULL, teleported = NULL, trigger_keys = NULL, virtual_ref = NULL, virtual_triggering = NULL )
id |
Dropdown ID. Auto-generated UUID if |
trigger_label |
The dropdown's trigger. Text gets a down arrow after
it; a tag – an icon, an avatar – is used as it is. Default
|
items |
A list of menu entries, each an
|
trigger |
Trigger event: |
type |
Button type when |
size |
Size: |
split_button |
Whether to render as a split button (main + dropdown
arrow). Default |
hide_on_click |
Whether to close the menu after an item is clicked.
Default |
placement |
Dropdown placement: |
disabled |
Whether the entire dropdown is disabled. Default |
show_timeout |
Delay in ms before the menu appears, for |
hide_timeout |
Delay in ms before the menu hides, for |
tabindex |
Tab index of the dropdown trigger. |
append_to |
Which element the dropdown CONTENT appends to. Element
Plus's |
button_props |
Props for the button component, refer to Button
Attributes. Element Plus's |
effect |
Tooltip theme, built-in theme: |
max_height |
The max height of menu. Element Plus's |
persistent |
When dropdown inactive and |
popper_class |
Custom class name for Dropdown's dropdown. Element
Plus's |
popper_options |
Popper.js parameters. Element Plus's |
popper_style |
Custom style for Dropdown's dropdown. Element Plus's
|
role |
The ARIA role attribute for the dropdown menu. Depending on the
use case, you may want to change this to 'navigation'. Element Plus's
|
show_arrow |
Whether the tooltip content has an arrow. Element Plus's
|
teleported |
Whether the dropdown popup is teleported to the body.
Element Plus's |
trigger_keys |
Specify which keys on the keyboard can trigger when
pressed. Element Plus's |
virtual_ref |
A CSS selector, |
virtual_triggering |
Whether virtual triggering is enabled. Element
Plus's |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList with a Vue-managed dropdown component.
| Input | Reported | Value |
input$<id> |
unasked | the command of the item clicked, as an event |
input$<id>_count |
unasked | the number of items clicked |
input$<id>_click |
unasked | if split-button is true, triggers when left button is clicked |
input$<id>_visible_change |
events = "visible_change" |
triggers when the dropdown appears/disappears, the param is true when it appears, and false otherwise |
The same list as el_events("el_dropdown"), which says how an event's arguments travel.
Server-side update for el_dropdown().
Every other argument of el_dropdown() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_dropdown() is called for its side effect and returns NULL invisibly.
el_dropdown( "dd1", "Actions", items = list( list(command = "edit", label = "Edit", icon = "el-icon-edit"), list(command = "copy", label = "Copy", icon = "el-icon-document"), list( command = "delete", label = "Delete", icon = "el-icon-delete", divided = TRUE ) ) ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_dropdown(session, "actions", disabled = TRUE) }) }el_dropdown( "dd1", "Actions", items = list( list(command = "edit", label = "Edit", icon = "el-icon-edit"), list(command = "copy", label = "Copy", icon = "el-icon-document"), list( command = "delete", label = "Delete", icon = "el-icon-delete", divided = TRUE ) ) ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_dropdown(session, "actions", disabled = TRUE) }) }
el_dropdown()'s menuElement Plus's el-dropdown-item, for el_dropdown(items =).
el_dropdown_item( command, label = command, icon = NULL, disabled = NULL, divided = NULL )el_dropdown_item( command, label = command, icon = NULL, disabled = NULL, divided = NULL )
command |
The value |
label |
The entry's text. Defaults to |
icon |
The entry's icon, by name. |
disabled |
Whether the entry is disabled. |
divided |
Whether a divider is drawn above the entry. |
An entry, for el_dropdown(items =).
Other items:
el_anchor_link(),
el_breadcrumb_item(),
el_carousel_item(),
el_collapse_item(),
el_descriptions_item(),
el_menu_item(),
el_option(),
el_skeleton_item(),
el_step(),
el_tab_pane(),
el_table_column(),
el_table_v2_column(),
el_timeline_item(),
el_tour_step()
el_dropdown( "dd", "Dropdown List", items = list( el_dropdown_item("apple", "Apple"), el_dropdown_item("pear", "Pear", disabled = TRUE), el_dropdown_item("plum", "Plum", divided = TRUE) ) )el_dropdown( "dd", "Dropdown List", items = list( el_dropdown_item("apple", "Apple"), el_dropdown_item("pear", "Pear", disabled = TRUE), el_dropdown_item("plum", "Plum", divided = TRUE) ) )
A placeholder for a view with nothing in it yet.
el_empty( id = NULL, ..., description = NULL, image = NULL, image_size = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_empty( session = shiny::getDefaultReactiveDomain(), id, description = NULL, image = NULL )el_empty( id = NULL, ..., description = NULL, image = NULL, image_size = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_empty( session = shiny::getDefaultReactiveDomain(), id, description = NULL, image = NULL )
id |
Component ID. Auto-generated if |
... |
Content under the description – usually a button that fixes the emptiness. A shiny.element component here is absorbed, not nested. |
description |
Text under the picture. |
image |
URL of a picture to use instead of Element's. |
image_size |
Width of the picture, in pixels. |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
Server-side update for el_empty().
update_el_empty() is called for its side effect and returns NULL invisibly.
el_empty("none", description = "No reports yet") el_empty( "none", description = "No reports yet", el_button("create", "Create one", type = "primary") ) if (interactive()) { # inside a server function observeEvent(input$search, { update_el_empty( session, "none", description = paste("Nothing matches", input$search) ) }) }el_empty("none", description = "No reports yet") el_empty( "none", description = "No reports yet", el_button("create", "Create one", type = "primary") ) if (interactive()) { # inside a server function observeEvent(input$search, { update_el_empty( session, "none", description = paste("Nothing matches", input$search) ) }) }
Every input a component can report, from one list: the ones it always
reports – its value, and the requests the server answers – and the
Element Plus events it forwards, some of them unasked (default) and the
rest when asked for with the component's events argument. Each is
input$<id>_<event>, the event in snake_case, namespaced in a module as
the component's id is.
el_events(component)el_events(component)
component |
A component function, or its name: |
A component's help page lists the same in its "Shiny inputs" section, and
an unknown name given to events is an error that lists them.
For an event not in the list – a key with a modifier, a DOM event on the
element Element draws – or to send something else than what an event
carries, give the component a handler of your own with on: see
el_widget().
An event's arguments are sent as they are when nothing is said in
value: one as itself, several as list(arg1, arg2, ...), none as
TRUE. Arguments that cannot travel – DOM nodes, a component's internal
objects – are dropped; a keyboard event is sent as list(key, code, ctrl, shift, alt, meta). Every event input is sent with priority = "event": an observer runs even when the value is the same as before.
A data frame, one row per input, of class el_events:
The input, input$<id> or input$<id>_<name>.
What to give events to have it reported: Element's
event in snake_case; NA for an input always reported.
TRUE when it is reported without being asked for.
When it is sent: Element's description of the event.
What it holds. Empty for an event whose arguments are sent as they are (see Details).
The event's arguments in Element.
el_events("el_tree") el_events(el_input) # asking for an event el_input("q", events = "keydown") # input$q_keydownel_events("el_tree") el_events(el_input) # asking for an event el_input("q", events = "keydown") # input$q_keydown
Closes the one opened under id, or every one currently showing when id
is NULL – Element's close() and closeAll().
el_message_close(session = shiny::getDefaultReactiveDomain(), id = NULL) el_notification_close(session = shiny::getDefaultReactiveDomain(), id = NULL)el_message_close(session = shiny::getDefaultReactiveDomain(), id = NULL) el_notification_close(session = shiny::getDefaultReactiveDomain(), id = NULL)
session |
Shiny session; the current one by default, as for
|
id |
The |
Called for its side effect; returns NULL invisibly.
if (interactive()) { # inside a server function observeEvent(input$start, { el_notification(session, "Uploading...", duration = 0, id = "up") }) observeEvent(input$done, { el_notification_close(session, "up") }) }if (interactive()) { # inside a server function observeEvent(input$start, { el_notification(session, "Uploading...", duration = 0, id = "up") }) observeEvent(input$done, { el_notification_close(session, "up") }) }
Loads the JavaScript handlers for el_notification() and el_message().
Automatically included by use_element() and el_page().
el_feedback_dependency()el_feedback_dependency()
An htmlDependency object.
el_feedback_dependency()el_feedback_dependency()
A form that owns its state, the way Element Plus intends: one Vue instance
holding a model of all field values plus the validation rules, with
async-validator running them on blur or change.
el_form( ..., id = NULL, label_width = "100px", label_position = "right", inline = FALSE, size = NULL, submit_label = "Submit", reset_label = NULL, disabled = NULL, show_message = NULL, inline_message = NULL, status_icon = NULL, hide_required_asterisk = NULL, label_suffix = NULL, validate_on_rule_change = NULL, require_asterisk_position = NULL, scroll_into_view_options = NULL, scroll_to_error = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_form( session = shiny::getDefaultReactiveDomain(), id, model = NULL, rules = NULL, label_width = NULL, label_position = NULL, fields = NULL, errors = NULL, inline = NULL, size = NULL, submit_label = NULL, reset_label = NULL, disabled = NULL, status_icon = NULL, hide_required_asterisk = NULL, validate_on_rule_change = NULL, require_asterisk_position = NULL, scroll_into_view_options = NULL, scroll_to_error = NULL )el_form( ..., id = NULL, label_width = "100px", label_position = "right", inline = FALSE, size = NULL, submit_label = "Submit", reset_label = NULL, disabled = NULL, show_message = NULL, inline_message = NULL, status_icon = NULL, hide_required_asterisk = NULL, label_suffix = NULL, validate_on_rule_change = NULL, require_asterisk_position = NULL, scroll_into_view_options = NULL, scroll_to_error = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_form( session = shiny::getDefaultReactiveDomain(), id, model = NULL, rules = NULL, label_width = NULL, label_position = NULL, fields = NULL, errors = NULL, inline = NULL, size = NULL, submit_label = NULL, reset_label = NULL, disabled = NULL, status_icon = NULL, hide_required_asterisk = NULL, validate_on_rule_change = NULL, require_asterisk_position = NULL, scroll_into_view_options = NULL, scroll_to_error = NULL )
... |
Fields, from |
id |
Form ID (auto-generated if NULL). |
label_width |
Label column width, e.g. |
label_position |
|
inline |
Lay the fields out in a row. |
size |
Size: |
submit_label |
Submit button text. |
reset_label |
Reset button text. |
disabled |
Whether every control in the form is disabled. |
show_message |
Whether to show validation messages. Default |
inline_message |
Whether to show validation messages inline. |
status_icon |
Whether to show a validation status icon in each field. |
hide_required_asterisk |
Whether to hide the asterisk next to required fields' labels. |
label_suffix |
Suffix appended to every label. |
validate_on_rule_change |
Whether changing the rules triggers validation immediately. |
require_asterisk_position |
Position of asterisk. Element Plus's
|
scroll_into_view_options |
When validation fails, it scrolls to the
first error item based on the scrollIntoView option. scrollIntoView.
Element Plus's |
scroll_to_error |
When validation fails, scroll to the first error
form entry. Element Plus's |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
model |
New field values. Merged into the existing model, so a partial list only changes the fields it names. |
rules |
New validation rules, as a named list of |
fields |
The form's fields, as |
errors |
Error messages from the server, as a named list keyed by
|
Fields are declared with el_form_field() rather than composed from the
package's standalone input components. Those are each their own Vue
instance, which puts them outside the form-item's component tree, where
Element's event chain and shared model cannot reach them.
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the whole model, on load and on every submit |
input$<id>_valid |
unasked | TRUE when the last submit passed validation |
input$<id>_submit |
unasked | a submit counter |
input$<id>_validate |
events = "validate" |
triggers after a form item is validated |
The same list as el_events("el_form"), which says how an event's arguments travel.
The model is deliberately not sent on every keystroke: that is the point of the form owning its state rather than each field reporting separately.
Callable with call_el():
clearValidate() – Clear validation message for certain fields. The parameter is prop name or an array of prop names of the...
clearValidate() – Remove validation status of the field
resetField() – Reset current field and remove validation result
resetFields() – Reset all the fields and remove validation result
validate() – Validate the whole form. Takes a callback as a param. After validation, the callback will be executed with...
validateField() – Validate one or several form items
update_el_form() changes the component from the server.
Every other argument of el_form() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_form() is called for its side effect and returns NULL invisibly.
el_form( id = "signup", label_width = "100px", el_form_field( "name", "input", label = "Name", rules = el_rule(required = TRUE, message = "Name is required") ), el_form_field( "age", "input-number", label = "Age", value = 18, min = 0, max = 150 ), el_form_field( "city", "select", label = "City", choices = c(Beijing = "bj", Shanghai = "sh"), rules = el_rule( required = TRUE, message = "Pick a city", trigger = "change" ) ) ) if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_form( id = "signup", label_width = "100px", reset_label = "Reset", el_form_field( "name", "input", label = "Name", rules = el_rule(required = TRUE, message = "Required") ), el_form_field( "email", "input", label = "Email", rules = el_rule(type = "email", message = "Invalid email") ) ), verbatimTextOutput("out") ) server <- function(input, output, session) { output$out <- renderPrint({ req(input$signup_submit) if (!isTRUE(input$signup_valid)) { return("Please fix the errors above") } input$signup }) } shinyApp(ui, server) } if (interactive()) { # Prefill the form from the server update_el_form(session, "signup", model = list(name = "Ada", age = 36)) # A check only the server can make update_el_form( session, "signup", errors = list(email = "That address is taken") ) }el_form( id = "signup", label_width = "100px", el_form_field( "name", "input", label = "Name", rules = el_rule(required = TRUE, message = "Name is required") ), el_form_field( "age", "input-number", label = "Age", value = 18, min = 0, max = 150 ), el_form_field( "city", "select", label = "City", choices = c(Beijing = "bj", Shanghai = "sh"), rules = el_rule( required = TRUE, message = "Pick a city", trigger = "change" ) ) ) if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_form( id = "signup", label_width = "100px", reset_label = "Reset", el_form_field( "name", "input", label = "Name", rules = el_rule(required = TRUE, message = "Required") ), el_form_field( "email", "input", label = "Email", rules = el_rule(type = "email", message = "Invalid email") ) ), verbatimTextOutput("out") ) server <- function(input, output, session) { output$out <- renderPrint({ req(input$signup_submit) if (!isTRUE(input$signup_valid)) { return("Please fix the errors above") } input$signup }) } shinyApp(ui, server) } if (interactive()) { # Prefill the form from the server update_el_form(session, "signup", model = list(name = "Ada", age = 36)) # A check only the server can make update_el_form( session, "signup", errors = list(email = "That address is taken") ) }
Leaves the values alone and only removes the error state.
el_form_clear_validate( session = shiny::getDefaultReactiveDomain(), id, props = NULL )el_form_clear_validate( session = shiny::getDefaultReactiveDomain(), id, props = NULL )
session |
Shiny session; the current one by default, as for
|
id |
Form ID (un-namespaced). |
props |
Fields to clear. |
Called for its side effect; returns NULL invisibly.
if (interactive()) { # inside a server function observeEvent(input$go, { el_form_clear_validate(session, "signup") }) }if (interactive()) { # inside a server function observeEvent(input$go, { el_form_clear_validate(session, "signup") }) }
Declare a form field
el_form_field( prop, type = "input", label = NULL, value = NULL, choices = NULL, rules = NULL, report = FALSE, button = FALSE, border = NULL, ..., options = NULL )el_form_field( prop, type = "input", label = NULL, value = NULL, choices = NULL, rules = NULL, report = FALSE, button = FALSE, border = NULL, ..., options = NULL )
prop |
Field name. Keys the form's model and is what
|
type |
Control type: one of |
label |
Label text. |
value |
Initial value. Defaults to the type's empty value, which is also
what |
choices, options
|
Options for |
rules |
A single |
report |
Whether the field also reports its value on load and on
every change, as |
button, border
|
For |
... |
Further props. Element's form-item props – |
A field declaration, for el_form().
el_form_field( "name", "input", label = "Name", rules = el_rule(required = TRUE, message = "Required") ) el_form_field( "age", "input-number", label = "Age", value = 18, min = 0, max = 150 ) el_form_field( "city", "select", label = "City", choices = c(Beijing = "bj", Shanghai = "sh") )el_form_field( "name", "input", label = "Name", rules = el_rule(required = TRUE, message = "Required") ) el_form_field( "age", "input-number", label = "Age", value = 18, min = 0, max = 150 ) el_form_field( "city", "select", label = "City", choices = c(Beijing = "bj", Shanghai = "sh") )
Element's form item holding more than one control, each with a form item of its own for its value and rules, laid out in columns – a date beside a time, as Element's own examples write it.
el_form_item(label = NULL, ..., spans = NULL, required = NULL, gutter = NULL)el_form_item(label = NULL, ..., spans = NULL, required = NULL, gutter = NULL)
label |
Label text. |
... |
Fields, from |
spans |
Column spans out of 24, one per entry in |
required |
Whether to mark the label as required. The fields' own
|
gutter |
Space between the columns, in pixels, as |
A field declaration, for el_form().
el_form( el_form_item( "Activity time", el_form_field("date1", "date-picker", style = "width: 100%"), "-", el_form_field("date2", "time-picker", style = "width: 100%") ) )el_form( el_form_item( "Activity time", el_form_field("date1", "date-picker", style = "width: 100%"), "-", el_form_field("date2", "time-picker", style = "width: 100%") ) )
Restores every field to the value it was declared with and clears the
validation state. Note this is Element Plus's resetFields(): it restores the
initial values, not empty ones, so a field declared with value = 18
resets to 18.
el_form_reset(session = shiny::getDefaultReactiveDomain(), id)el_form_reset(session = shiny::getDefaultReactiveDomain(), id)
session |
Shiny session; the current one by default, as for
|
id |
Form ID (un-namespaced). |
Called for its side effect; returns NULL invisibly.
if (interactive()) { # inside a server function observeEvent(input$go, { el_form_reset(session, "signup") }) }if (interactive()) { # inside a server function observeEvent(input$go, { el_form_reset(session, "signup") }) }
Runs the form's rules and reports the outcome the same way a submit does,
so the same observeEvent handles both. Use it when the form has no submit
button of its own (submit_label = NULL).
el_form_validate(session = shiny::getDefaultReactiveDomain(), id)el_form_validate(session = shiny::getDefaultReactiveDomain(), id)
session |
Shiny session; the current one by default, as for
|
id |
Form ID (un-namespaced). |
Called for its side effect; returns NULL invisibly.
if (interactive()) { # inside a server function observeEvent(input$go, { el_form_validate(session, "signup") }) }if (interactive()) { # inside a server function observeEvent(input$go, { el_form_validate(session, "signup") }) }
Element Plus Header
el_header(..., height = "60px", style = NULL, class = NULL)el_header(..., height = "60px", style = NULL, class = NULL)
... |
Content. |
height |
Header height. Defaults to |
style |
Extra inline style. |
class |
Extra CSS classes. |
A Shiny UI element.
el_header("Dashboard") el_header(height = "80px", el_button("refresh", "Refresh"))el_header("Dashboard") el_header(height = "80px", el_button("refresh", "Refresh"))
An icon from Element Plus's set, Font Awesome, or a plain tag. Follows the
same dispatch pattern as shiny::icon(), with accessibility attributes
inspired by bsicons::bs_icon().
el_icon( name, size = NULL, class = NULL, title = NULL, a11y = c("auto", "deco", "sem", "none"), lib = c("element-plus", "font-awesome", "none"), ..., color = NULL )el_icon( name, size = NULL, class = NULL, title = NULL, a11y = c("auto", "deco", "sem", "none"), lib = c("element-plus", "font-awesome", "none"), ..., color = NULL )
name |
Icon name, as Element Plus spells it – |
size |
CSS size string (e.g. |
class |
Additional CSS class(es) to append. |
title |
Accessible title string. When provided, it also drives |
a11y |
Accessibility mode. One of:
|
lib |
Icon library. One of:
|
... |
Additional HTML attributes passed to the |
color |
Icon colour, as Element Plus's |
Element Plus's icons are SVG components (@element-plus/icons-vue, bundled):
the tag is an <i class="el-icon"> naming its icon, drawn by the page
wherever it lands – inside a component or not.
An htmltools tag object.
el_icon("Search") el_icon("edit", size = "1.5em") el_icon("Delete", title = "Delete item", color = "#f56c6c") el_icon("close", a11y = "deco")el_icon("Search") el_icon("edit", size = "1.5em") el_icon("Delete", title = "Delete item", color = "#f56c6c") el_icon("close", a11y = "deco")
An image with a fit mode, optional lazy loading, and an optional full-screen preview.
el_image( id = NULL, src = NULL, fit = NULL, alt = NULL, lazy = NULL, scroll_container = NULL, preview_src_list = NULL, z_index = NULL, initial_index = NULL, close_on_press_escape = NULL, crossorigin = NULL, hide_on_click_modal = NULL, infinite = NULL, loading = NULL, max_scale = NULL, min_scale = NULL, preview_teleported = NULL, referrerpolicy = NULL, scale = NULL, show_progress = NULL, zoom_rate = NULL, width = NULL, class = NULL, style = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_image( session = shiny::getDefaultReactiveDomain(), id, src = NULL, fit = NULL, preview_src_list = NULL, alt = NULL, lazy = NULL, scroll_container = NULL, z_index = NULL, initial_index = NULL, close_on_press_escape = NULL, crossorigin = NULL, hide_on_click_modal = NULL, infinite = NULL, loading = NULL, max_scale = NULL, min_scale = NULL, preview_teleported = NULL, referrerpolicy = NULL, scale = NULL, show_progress = NULL, zoom_rate = NULL )el_image( id = NULL, src = NULL, fit = NULL, alt = NULL, lazy = NULL, scroll_container = NULL, preview_src_list = NULL, z_index = NULL, initial_index = NULL, close_on_press_escape = NULL, crossorigin = NULL, hide_on_click_modal = NULL, infinite = NULL, loading = NULL, max_scale = NULL, min_scale = NULL, preview_teleported = NULL, referrerpolicy = NULL, scale = NULL, show_progress = NULL, zoom_rate = NULL, width = NULL, class = NULL, style = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_image( session = shiny::getDefaultReactiveDomain(), id, src = NULL, fit = NULL, preview_src_list = NULL, alt = NULL, lazy = NULL, scroll_container = NULL, z_index = NULL, initial_index = NULL, close_on_press_escape = NULL, crossorigin = NULL, hide_on_click_modal = NULL, infinite = NULL, loading = NULL, max_scale = NULL, min_scale = NULL, preview_teleported = NULL, referrerpolicy = NULL, scale = NULL, show_progress = NULL, zoom_rate = NULL )
id |
Image ID. Auto-generated if |
src |
Image URL. |
fit |
How the image fills its box: |
alt |
Alternative text. |
lazy |
Whether to load the image only once it scrolls into view. |
scroll_container |
CSS selector of the scrolling element to watch when
|
preview_src_list |
Character vector of image URLs to show in a full-screen preview when the image is clicked. |
z_index |
Stacking order of the preview. Default |
initial_index |
Which image of |
close_on_press_escape |
Whether the image-viewer can be closed by
pressing ESC. Element Plus's |
crossorigin |
Native attribute crossorigin. Element Plus's
|
hide_on_click_modal |
When enabling preview, use this flag to control
whether clicking on backdrop can exit preview mode. Element Plus's
|
infinite |
Whether the viewer preview is infinite. Element Plus's
|
loading |
Indicates how the browser should load the image, same as
native. Element Plus's |
max_scale |
The max scale of the image viewer zoom event. Element
Plus's |
min_scale |
The min scale of the image viewer zoom event. Element
Plus's |
preview_teleported |
Whether to append image-viewer to body. A nested
parent element attribute transform should have this attribute set to
|
referrerpolicy |
Native attribute referrerPolicy. Element Plus's
|
scale |
The preview image scale. Element Plus's |
show_progress |
Whether to display the preview image progress content.
Element Plus's |
zoom_rate |
The zoom rate of the image viewer zoom event. Element
Plus's |
width |
Component width, as a CSS unit. |
class, style
|
Extra classes and inline style on the image's box, as
Element passes them through: |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
| Input | Reported | Value |
input$<id>_load |
events = "load" |
same as native load. |
input$<id>_error |
unasked | same as native error. |
input$<id>_close |
events = "close" |
trigger when clicking on close button or when hide-on-click-modal enabled clicking on backdrop. |
input$<id>_show |
events = "show" |
trigger when the viewer displays |
input$<id>_switch |
events = "switch" |
trigger when switching images. |
The same list as el_events("el_image"), which says how an event's arguments travel.
Server-side update for el_image().
Every other argument of el_image() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_image() is called for its side effect and returns NULL invisibly.
el_image("photo", src = "https://example.org/a.png", width = 200) el_image("photo", src = "a.png", fit = "cover", lazy = TRUE) # Click to open a gallery el_image( "photo", src = "a.png", preview_src_list = c("a.png", "b.png", "c.png") ) if (interactive()) { # inside a server function observeEvent(input$next_photo, { update_el_image(session, "photo", src = photo_url()) }) }el_image("photo", src = "https://example.org/a.png", width = 200) el_image("photo", src = "a.png", fit = "cover", lazy = TRUE) # Click to open a gallery el_image( "photo", src = "a.png", preview_src_list = c("a.png", "b.png", "c.png") ) if (interactive()) { # inside a server function observeEvent(input$next_photo, { update_el_image(session, "photo", src = photo_url()) }) }
A full-screen viewer for a list of images, with zoom and rotation.
el_image_viewer( id = NULL, url_list = NULL, visible = FALSE, z_index = NULL, initial_index = NULL, infinite = NULL, hide_on_click_modal = NULL, teleported = NULL, zoom_rate = NULL, scale = NULL, min_scale = NULL, max_scale = NULL, close_on_press_escape = NULL, show_progress = NULL, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_image_viewer( session = shiny::getDefaultReactiveDomain(), id, visible = NULL, url_list = NULL, initial_index = NULL, z_index = NULL, infinite = NULL, hide_on_click_modal = NULL, teleported = NULL, zoom_rate = NULL, scale = NULL, min_scale = NULL, max_scale = NULL, close_on_press_escape = NULL, show_progress = NULL )el_image_viewer( id = NULL, url_list = NULL, visible = FALSE, z_index = NULL, initial_index = NULL, infinite = NULL, hide_on_click_modal = NULL, teleported = NULL, zoom_rate = NULL, scale = NULL, min_scale = NULL, max_scale = NULL, close_on_press_escape = NULL, show_progress = NULL, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_image_viewer( session = shiny::getDefaultReactiveDomain(), id, visible = NULL, url_list = NULL, initial_index = NULL, z_index = NULL, infinite = NULL, hide_on_click_modal = NULL, teleported = NULL, zoom_rate = NULL, scale = NULL, min_scale = NULL, max_scale = NULL, close_on_press_escape = NULL, show_progress = NULL )
id |
Component ID. Auto-generated if |
url_list |
Preview link list. Element Plus's |
visible |
Whether it starts open. Open and close it later with
|
z_index |
Preview backdrop z-index. Element Plus's |
initial_index |
The initial preview image index, less than or equal to
the length of |
infinite |
Whether preview is infinite. Element Plus's |
hide_on_click_modal |
Whether user can emit close event when clicking
backdrop. Element Plus's |
teleported |
Whether to append image itself to body. A nested parent
element attribute transform should have this attribute set to |
zoom_rate |
The zoom rate of the image viewer zoom event. Element
Plus's |
scale |
The preview image scale. Element Plus's |
min_scale |
The min scale of the image viewer zoom event. Element
Plus's |
max_scale |
The max scale of the image viewer zoom event. Element
Plus's |
close_on_press_escape |
Whether the image-viewer can be closed by
pressing ESC. Element Plus's |
show_progress |
Whether to display the preview image progress content.
Element Plus's |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents: |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id>_close |
unasked | fires as it closes |
input$<id>_error |
unasked | same as native error. |
input$<id>_switch |
events = "switch" |
trigger when switching images. |
input$<id>_rotate |
events = "rotate" |
trigger when rotating images. |
The same list as el_events("el_image_viewer"), which says how an event's arguments travel.
Callable with call_el(): setActiveItem().
Open or close an el_image_viewer(), or give it other images.
Every other argument of el_image_viewer() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_image_viewer() is called for its side effect and returns NULL invisibly.
if (interactive()) { # inside a server function observeEvent( input$show, update_el_image_viewer(session, "photos", visible = TRUE) ) }if (interactive()) { # inside a server function observeEvent( input$show, update_el_image_viewer(session, "photos", visible = TRUE) ) }
A scrolling area that asks the server for more as the user nears the bottom. Element implements this as a directive rather than a component, so the area is a container you put content into.
el_infinite_scroll( id = NULL, ..., height = "300px", disabled = NULL, delay = NULL, distance = NULL, immediate = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_infinite_scroll( session = shiny::getDefaultReactiveDomain(), id, disabled = NULL, delay = NULL, distance = NULL )el_infinite_scroll( id = NULL, ..., height = "300px", disabled = NULL, delay = NULL, distance = NULL, immediate = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_infinite_scroll( session = shiny::getDefaultReactiveDomain(), id, disabled = NULL, delay = NULL, distance = NULL )
id |
Container ID. Auto-generated if |
... |
Content of the scrolling area. Any Shiny UI, including
shiny.element components – those are folded into this container's Vue
instance rather than nested inside it, so their inputs keep reporting.
Their |
height |
Height of the area, as a CSS unit. Needed for it to scroll at
all. Default |
disabled |
Whether loading is suspended. Set it from the server while a request is in flight, and again when there is nothing left to fetch. |
delay |
Throttle between checks, in milliseconds. Default |
distance |
How near the bottom to get before asking, in pixels.
Default |
immediate |
Whether to ask once on load, in case the content does not
fill the area. Default |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents, such as
|
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
| Input | Reported | Value |
input$<id>_load |
unasked | rises by one each time more content is wanted |
The same list as el_events("el_infinite_scroll"), which says how an event's arguments travel.
Observe input$<id>_load, fetch the next page, and render it into a
shiny::uiOutput() inside the area.
Server-side update for el_infinite_scroll(). Setting disabled is how a
feed stops asking once everything has been sent.
update_el_infinite_scroll() is called for its side effect and returns NULL invisibly.
el_infinite_scroll("feed", shiny::uiOutput("rows"), height = "400px") if (interactive()) { library(shiny) library(shiny.element) ui <- el_page(el_infinite_scroll("feed", uiOutput("rows"))) server <- function(input, output, session) { shown <- reactiveVal(20) observeEvent(input$feed_load, { shown(min(shown() + 20, nrow(iris))) }) output$rows <- renderUI({ lapply(seq_len(shown()), function(i) tags$p(paste("Row", i))) }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$feed_load, { if (all_rows_sent()) { update_el_infinite_scroll(session, "feed", disabled = TRUE) } }) }el_infinite_scroll("feed", shiny::uiOutput("rows"), height = "400px") if (interactive()) { library(shiny) library(shiny.element) ui <- el_page(el_infinite_scroll("feed", uiOutput("rows"))) server <- function(input, output, session) { shown <- reactiveVal(20) observeEvent(input$feed_load, { shown(min(shown() + 20, nrow(iris))) }) output$rows <- renderUI({ lapply(seq_len(shown()), function(i) tags$p(paste("Row", i))) }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$feed_load, { if (all_rows_sent()) { update_el_infinite_scroll(session, "feed", disabled = TRUE) } }) }
Creates an Element Plus input component (<el-input>) with a Vue instance,
supporting text, textarea, and password modes, plus clearable, prefix/suffix
icons, word-limit display, and autosize textarea.
el_input( id = NULL, value = "", placeholder = NULL, type = "text", size = NULL, disabled = FALSE, readonly = FALSE, clearable = FALSE, show_password = FALSE, show_word_limit = FALSE, maxlength = NULL, rows = NULL, autosize = FALSE, prefix_icon = NULL, suffix_icon = NULL, label = NULL, autocomplete = NULL, autofocus = NULL, name = NULL, form = NULL, minlength = NULL, max = NULL, min = NULL, step = NULL, resize = NULL, tabindex = NULL, validate_event = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, aria_label = NULL, clear_icon = NULL, count_graphemes = NULL, formatter = NULL, input_style = NULL, inputmode = NULL, parser = NULL, word_limit_position = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_input( session = shiny::getDefaultReactiveDomain(), id, value = NULL, placeholder = NULL, disabled = NULL, readonly = NULL, type = NULL, size = NULL, clearable = NULL, show_password = NULL, label = NULL, error = NULL, show_word_limit = NULL, maxlength = NULL, rows = NULL, autosize = NULL, prefix_icon = NULL, suffix_icon = NULL, autocomplete = NULL, autofocus = NULL, name = NULL, form = NULL, minlength = NULL, max = NULL, min = NULL, step = NULL, resize = NULL, tabindex = NULL, validate_event = NULL, aria_label = NULL, clear_icon = NULL, count_graphemes = NULL, formatter = NULL, input_style = NULL, inputmode = NULL, parser = NULL, word_limit_position = NULL )el_input( id = NULL, value = "", placeholder = NULL, type = "text", size = NULL, disabled = FALSE, readonly = FALSE, clearable = FALSE, show_password = FALSE, show_word_limit = FALSE, maxlength = NULL, rows = NULL, autosize = FALSE, prefix_icon = NULL, suffix_icon = NULL, label = NULL, autocomplete = NULL, autofocus = NULL, name = NULL, form = NULL, minlength = NULL, max = NULL, min = NULL, step = NULL, resize = NULL, tabindex = NULL, validate_event = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, aria_label = NULL, clear_icon = NULL, count_graphemes = NULL, formatter = NULL, input_style = NULL, inputmode = NULL, parser = NULL, word_limit_position = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_input( session = shiny::getDefaultReactiveDomain(), id, value = NULL, placeholder = NULL, disabled = NULL, readonly = NULL, type = NULL, size = NULL, clearable = NULL, show_password = NULL, label = NULL, error = NULL, show_word_limit = NULL, maxlength = NULL, rows = NULL, autosize = NULL, prefix_icon = NULL, suffix_icon = NULL, autocomplete = NULL, autofocus = NULL, name = NULL, form = NULL, minlength = NULL, max = NULL, min = NULL, step = NULL, resize = NULL, tabindex = NULL, validate_event = NULL, aria_label = NULL, clear_icon = NULL, count_graphemes = NULL, formatter = NULL, input_style = NULL, inputmode = NULL, parser = NULL, word_limit_position = NULL )
id |
Input ID. Auto-generated UUID if |
value |
Initial input value. Default |
placeholder |
Placeholder text. |
type |
Input type: |
size |
Size: |
disabled |
Whether the input is disabled. Default |
readonly |
Whether the input is read-only. Default |
clearable |
Whether to show a clear button. Default |
show_password |
Whether to show the password toggle icon.
Only meaningful when |
show_word_limit |
Whether to show a word-count badge.
Requires |
maxlength |
Maximum character count. |
rows |
Number of rows for |
autosize |
Whether to auto-size the textarea height. Either |
prefix_icon |
Icon class for the prefix slot (e.g. |
suffix_icon |
Icon class for the suffix slot (e.g. |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
autocomplete |
Native |
autofocus |
Whether the input takes focus on page load. Default |
name |
Native |
form |
Native |
minlength |
Minimum input length. |
max |
Native |
min |
Native |
step |
Native |
resize |
Resize behaviour of a textarea: |
tabindex |
Tab index of the input. |
validate_event |
Whether a change triggers form validation. Default |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
aria_label |
Same as |
clear_icon |
Custom clear icon component. Element Plus's |
count_graphemes |
Custom function to count graphemes; when set, native
|
formatter |
Specifies the format of the value presented input.(only
works when |
input_style |
The style of the input element or textarea element.
Element Plus's |
inputmode |
Same as |
parser |
Specifies the value extracted from formatter input.(only
works when |
word_limit_position |
Word count position, valid when
|
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList with a Vue-managed input component.
Callable with call_el():
blur() – Blur the input element
focus() – Focus the input element
select() – Select the text in input element
| Input | Reported | Value |
input$<id> |
unasked | the text, as it is typed (debounced by 250 ms) |
input$<id>_input |
events = "input" |
triggers when the Input value change |
input$<id>_blur |
events = "blur" |
triggers when Input blurs |
input$<id>_focus |
events = "focus" |
triggers when Input focuses |
input$<id>_clear |
events = "clear" |
triggers when the Input is cleared by clicking the clear button |
input$<id>_compositionend |
events = "compositionend" |
triggers when the composition ends |
input$<id>_compositionstart |
events = "compositionstart" |
triggers when the composition starts |
input$<id>_compositionupdate |
events = "compositionupdate" |
triggers when the composition is updated |
input$<id>_keydown |
events = "keydown" |
the key: list(key, code, ctrl, shift, alt, meta) |
input$<id>_mouseenter |
events = "mouseenter" |
triggers when the mouse enters the Input element |
input$<id>_mouseleave |
events = "mouseleave" |
triggers when the mouse leaves the Input element |
The same list as el_events("el_input"), which says how an event's arguments travel.
The text is debounced by 250 ms, as shiny::textInput()'s is, and
reported after an update_el_input() too.
Server-side update for el_input(). Sends a custom message to update
named fields on the Vue instance.
Every other argument of el_input() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_input() is called for its side effect and returns NULL invisibly.
# Basic text input el_input("name", placeholder = "Enter your name") # Clearable search input with icon el_input( "search", placeholder = "Search...", clearable = TRUE, prefix_icon = "el-icon-search" ) # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_input("txt", placeholder = "Type something"), verbatimTextOutput("val") ) server <- function(input, output, session) { output$val <- renderPrint(input$txt) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_input(session, "name", value = "Ada") }) }# Basic text input el_input("name", placeholder = "Enter your name") # Clearable search input with icon el_input( "search", placeholder = "Search...", clearable = TRUE, prefix_icon = "el-icon-search" ) # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_input("txt", placeholder = "Type something"), verbatimTextOutput("val") ) server <- function(input, output, session) { output$val <- renderPrint(input$txt) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_input(session, "name", value = "Ada") }) }
A numeric input with increment/decrement buttons.
el_input_number( id = NULL, value = 0, min = -Inf, max = Inf, step = 1, step_strictly = FALSE, precision = NULL, size = NULL, disabled = FALSE, controls = TRUE, controls_position = "", placeholder = NULL, label = NULL, name = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, align = NULL, aria_label = NULL, disabled_scientific = NULL, formatter = NULL, inputmode = NULL, parser = NULL, readonly = NULL, tabindex = NULL, validate_event = NULL, value_on_clear = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_input_number( session = shiny::getDefaultReactiveDomain(), id, value = NULL, min = NULL, max = NULL, disabled = NULL, label = NULL, error = NULL, step = NULL, step_strictly = NULL, precision = NULL, size = NULL, controls = NULL, controls_position = NULL, placeholder = NULL, name = NULL, align = NULL, aria_label = NULL, disabled_scientific = NULL, formatter = NULL, inputmode = NULL, parser = NULL, readonly = NULL, tabindex = NULL, validate_event = NULL, value_on_clear = NULL )el_input_number( id = NULL, value = 0, min = -Inf, max = Inf, step = 1, step_strictly = FALSE, precision = NULL, size = NULL, disabled = FALSE, controls = TRUE, controls_position = "", placeholder = NULL, label = NULL, name = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, align = NULL, aria_label = NULL, disabled_scientific = NULL, formatter = NULL, inputmode = NULL, parser = NULL, readonly = NULL, tabindex = NULL, validate_event = NULL, value_on_clear = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_input_number( session = shiny::getDefaultReactiveDomain(), id, value = NULL, min = NULL, max = NULL, disabled = NULL, label = NULL, error = NULL, step = NULL, step_strictly = NULL, precision = NULL, size = NULL, controls = NULL, controls_position = NULL, placeholder = NULL, name = NULL, align = NULL, aria_label = NULL, disabled_scientific = NULL, formatter = NULL, inputmode = NULL, parser = NULL, readonly = NULL, tabindex = NULL, validate_event = NULL, value_on_clear = NULL )
id |
Input ID. Auto-generated UUID if |
value |
Initial numeric value. Default |
min |
Minimum allowed value. Default |
max |
Maximum allowed value. Default |
step |
Step increment. Default |
step_strictly |
Force the value to be a multiple of |
precision |
Decimal precision (non-negative integer). |
size |
Size: |
disabled |
Whether the component is disabled. Default |
controls |
Whether to show the +/- control buttons. Default |
controls_position |
Button layout: |
placeholder |
Placeholder text. |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
name |
Native |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
align |
Alignment for the inner input text. Element Plus's |
aria_label |
Same as |
disabled_scientific |
Disables input of scientific notation (e.g.
'e'). Element Plus's |
formatter |
Specifies the format of the value presented in the input.
Element Plus's |
inputmode |
Same as |
parser |
Specifies the value extracted from the formatted input.
Element Plus's |
readonly |
Same as |
tabindex |
Same as |
validate_event |
Whether to trigger form validation. Element Plus's
|
value_on_clear |
Value should be set when input box is cleared.
Element Plus's |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList with a Vue-managed input-number component.
Callable with call_el():
focus() – Focus the Input component
select() – Select the text in input element
| Input | Reported | Value |
input$<id> |
unasked | the number |
input$<id>_blur |
events = "blur" |
triggers when Input blurs |
input$<id>_focus |
events = "focus" |
triggers when Input focuses |
The same list as el_events("el_input_number"), which says how an event's arguments travel.
Server-side update for el_input_number().
Every other argument of el_input_number() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_input_number() is called for its side effect and returns NULL invisibly.
el_input_number("n1", value = 5, min = 0, max = 100) el_input_number("n2", value = 1.5, step = 0.5, precision = 1) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_input_number(session, "age", value = 42) }) }el_input_number("n1", value = 5, min = 0, max = 100) el_input_number("n2", value = 1.5, step = 0.5, precision = 1) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_input_number(session, "age", value = 42) }) }
A one-time password or verification code, typed one character per field.
el_input_otp( id = NULL, value = NULL, length = NULL, validator = NULL, inputmode = NULL, type = NULL, size = NULL, mask = NULL, disabled = NULL, separator = NULL, validate_event = NULL, readonly = NULL, aria_label = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_input_otp( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, length = NULL, validator = NULL, inputmode = NULL, type = NULL, size = NULL, mask = NULL, separator = NULL, validate_event = NULL, readonly = NULL, aria_label = NULL )el_input_otp( id = NULL, value = NULL, length = NULL, validator = NULL, inputmode = NULL, type = NULL, size = NULL, mask = NULL, disabled = NULL, separator = NULL, validate_event = NULL, readonly = NULL, aria_label = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_input_otp( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, length = NULL, validator = NULL, inputmode = NULL, type = NULL, size = NULL, mask = NULL, separator = NULL, validate_event = NULL, readonly = NULL, aria_label = NULL )
id |
Component ID. Auto-generated if |
value |
The value of the OTP fields. Since numbers must not have
leading zeros, |
length |
The OTP fields length. Element Plus's |
validator |
Custom validator function. Element Plus's |
inputmode |
Native |
type |
The type of the OTP fields. Element Plus's |
size |
The size of the OTP fields. Element Plus's |
mask |
Whether to enable password mode. Element Plus's |
disabled |
Whether the OTP fields are disabled. Element Plus's
|
separator |
The separator between OTP fields. Element Plus's
|
validate_event |
Whether to trigger form validation. Element Plus's
|
readonly |
Same as |
aria_label |
Native |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents: |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the value |
input$<id>_change |
events = "change" |
Triggers when the value changes after input blur |
input$<id>_finish |
unasked | Fires when all fields have been filled |
input$<id>_focus |
events = "focus" |
Triggers when input is focused |
input$<id>_blur |
events = "blur" |
Triggers when input is blurred |
The same list as el_events("el_input_otp"), which says how an event's arguments travel.
Callable with call_el(): focus(), blur().
Server-side update for el_input_otp().
Every other argument of el_input_otp() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_input_otp() is called for its side effect and returns NULL invisibly.
el_input_otp("code", length = 6) el_input_otp("pin", length = 4, mask = TRUE, type = "underlined") if (interactive()) { # inside a server function observeEvent(input$reset, update_el_input_otp(session, "x", value = NULL)) }el_input_otp("code", length = 6) el_input_otp("pin", length = 4, mask = TRUE, type = "underlined") if (interactive()) { # inside a server function observeEvent(input$reset, update_el_input_otp(session, "x", value = NULL)) }
A text input that turns each entry into a tag: keywords, e-mail addresses, labels.
el_input_tag( id = NULL, value = list(), max = NULL, tag_type = NULL, tag_effect = NULL, effect = NULL, trigger = NULL, draggable = NULL, delimiter = NULL, size = NULL, collapse_tags = NULL, collapse_tags_tooltip = NULL, save_on_blur = NULL, clearable = NULL, clear_icon = NULL, disabled = NULL, validate_event = NULL, readonly = NULL, autofocus = NULL, tabindex = NULL, max_collapse_tags = NULL, maxlength = NULL, minlength = NULL, placeholder = NULL, autocomplete = NULL, aria_label = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_input_tag( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, max = NULL, tag_type = NULL, tag_effect = NULL, effect = NULL, trigger = NULL, draggable = NULL, delimiter = NULL, size = NULL, collapse_tags = NULL, collapse_tags_tooltip = NULL, save_on_blur = NULL, clearable = NULL, clear_icon = NULL, validate_event = NULL, readonly = NULL, autofocus = NULL, tabindex = NULL, max_collapse_tags = NULL, maxlength = NULL, minlength = NULL, placeholder = NULL, autocomplete = NULL, aria_label = NULL )el_input_tag( id = NULL, value = list(), max = NULL, tag_type = NULL, tag_effect = NULL, effect = NULL, trigger = NULL, draggable = NULL, delimiter = NULL, size = NULL, collapse_tags = NULL, collapse_tags_tooltip = NULL, save_on_blur = NULL, clearable = NULL, clear_icon = NULL, disabled = NULL, validate_event = NULL, readonly = NULL, autofocus = NULL, tabindex = NULL, max_collapse_tags = NULL, maxlength = NULL, minlength = NULL, placeholder = NULL, autocomplete = NULL, aria_label = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_input_tag( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, max = NULL, tag_type = NULL, tag_effect = NULL, effect = NULL, trigger = NULL, draggable = NULL, delimiter = NULL, size = NULL, collapse_tags = NULL, collapse_tags_tooltip = NULL, save_on_blur = NULL, clearable = NULL, clear_icon = NULL, validate_event = NULL, readonly = NULL, autofocus = NULL, tabindex = NULL, max_collapse_tags = NULL, maxlength = NULL, minlength = NULL, placeholder = NULL, autocomplete = NULL, aria_label = NULL )
id |
Component ID. Auto-generated if |
value |
Binding value: Element Plus's |
max |
Max number tags that can be enter. Element Plus's |
tag_type |
Tag type. Element Plus's |
tag_effect |
Tag effect. Element Plus's |
effect |
Tooltip theme, built-in theme: |
trigger |
The key to trigger input tag. Element Plus's |
draggable |
Whether tags can be dragged. Element Plus's |
delimiter |
Add a tag when a delimiter is matched. Element Plus's
|
size |
Input box size. Element Plus's |
collapse_tags |
Whether to collapse tags to a text when multiple
selecting. Element Plus's |
collapse_tags_tooltip |
Whether show all selected tags when mouse
hover text of collapse-tags. To use this, collapse-tags must be true.
Element Plus's |
save_on_blur |
Whether to save the input value when the input loses
focus. Element Plus's |
clearable |
Whether to show clear button. Element Plus's |
clear_icon |
Custom clear icon component. Element Plus's |
disabled |
Whether to disable input-tag. Element Plus's |
validate_event |
Whether to trigger form validation. Element Plus's
|
readonly |
Same as |
autofocus |
Same as |
tabindex |
Same as |
max_collapse_tags |
The max tags number to be shown. To use this,
collapse-tags must be true. Element Plus's |
maxlength |
Same as |
minlength |
Same as |
placeholder |
Placeholder of input. Element Plus's |
autocomplete |
Same as |
aria_label |
Native |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents: |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the tags |
input$<id>_input |
events = "input" |
triggers when the input value change |
input$<id>_add_tag |
events = "add_tag" |
triggers when a tag is added |
input$<id>_remove_tag |
events = "remove_tag" |
triggers when a tag is removed |
input$<id>_drag_tag |
events = "drag_tag" |
triggers when a tag is dragged |
input$<id>_focus |
events = "focus" |
triggers when InputTag focuses |
input$<id>_blur |
events = "blur" |
triggers when InputTag blurs |
input$<id>_clear |
events = "clear" |
triggers when the clear icon is clicked |
The same list as el_events("el_input_tag"), which says how an event's arguments travel.
Callable with call_el(): focus(), blur().
Server-side update for el_input_tag().
Every other argument of el_input_tag() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_input_tag() is called for its side effect and returns NULL invisibly.
el_input_tag( "keywords", value = c("shiny", "element"), placeholder = "Add a keyword" ) if (interactive()) { # inside a server function observeEvent(input$reset, update_el_input_tag(session, "x", value = NULL)) }el_input_tag( "keywords", value = c("shiny", "element"), placeholder = "Add a keyword" ) if (interactive()) { # inside a server function observeEvent(input$reset, update_el_input_tag(session, "x", value = NULL)) }
Provides default CSS styles for Element-UI layout and grid components, including el-container, el-header, el-main, el-footer, el-aside, el-row, el-col, etc. This dependency is automatically attached by el_page() for consistent layout appearance.
el_layout_css_dependency()el_layout_css_dependency()
An htmlDependency object.
el_layout_css_dependency()el_layout_css_dependency()
A styled hyperlink that follows Element Plus's design language.
el_link( label = "Link", href = NULL, type = NULL, underline = NULL, disabled = FALSE, icon = NULL, id = NULL, ..., target = "_self", on = NULL ) update_el_link( session = shiny::getDefaultReactiveDomain(), id, label = NULL, href = NULL, type = NULL, underline = NULL, disabled = NULL, icon = NULL )el_link( label = "Link", href = NULL, type = NULL, underline = NULL, disabled = FALSE, icon = NULL, id = NULL, ..., target = "_self", on = NULL ) update_el_link( session = shiny::getDefaultReactiveDomain(), id, label = NULL, href = NULL, type = NULL, underline = NULL, disabled = NULL, icon = NULL )
label |
Link text. Accepts a string or HTML tag. |
href |
URL target. |
type |
Link colour type: |
underline |
When the link is underlined: |
disabled |
Whether the link is disabled. Default |
icon |
Icon class string (e.g. |
id |
Give the link an id and it reports its clicks, as
|
... |
Additional HTML attributes passed to the |
target |
Where the link opens, as an |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
An htmltools <a> tag, or with an id a Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | with an id, the number of clicks, as actionLink() reports it
|
The same list as el_events("el_link"), which says how an event's arguments travel.
Server-side update for an el_link() given an id.
update_el_link() is called for its side effect and returns NULL invisibly.
el_link("Visit GitHub", href = "https://github.com", type = "primary") el_link("Disabled", disabled = TRUE) el_link("With icon", icon = "el-icon-edit", type = "success") # An action link: input$more counts its clicks el_link("Show more", id = "more", type = "primary") if (interactive()) { # inside a server function observeEvent(input$more, update_el_link(session, "more", label = "Show less")) }el_link("Visit GitHub", href = "https://github.com", type = "primary") el_link("Disabled", disabled = TRUE) el_link("With icon", icon = "el-icon-edit", type = "success") # An action link: input$more counts its clicks el_link("Show more", id = "more", type = "primary") if (interactive()) { # inside a server function observeEvent(input$more, update_el_link(session, "more", label = "Show less")) }
Element loads some components a piece at a time: a lazy tree its nodes'
children, a lazy cascader its next column, a lazy tree table its rows'
children. Upstream, a JavaScript function you write fetches them. Here
the server does: the component asks through an input – input$<id>_load
for a tree or table, input$<id>_lazy_load for a cascader – and waits
until this function answers.
el_load_children( session = shiny::getDefaultReactiveDomain(), id, request, children = list(), reject = FALSE )el_load_children( session = shiny::getDefaultReactiveDomain(), id, request, children = list(), reject = FALSE )
session |
Shiny session; the current one by default, as for
|
id |
The component's ID (un-namespaced). |
request |
The question, as it arrived in |
children |
What to load. For a tree, nodes such as |
reject |
|
Each question carries a request number, so answers find their way back
even when several are open at once; pass the question back whole.
Called for its side effect; returns NULL invisibly.
if (interactive()) { library(shiny) ui <- el_page(el_tree( "files", lazy = TRUE, node_key = "id", props = list(isLeaf = "leaf") )) server <- function(input, output, session) { observeEvent(input$files_load, { q <- input$files_load dir <- if (q$level == 0) "~" else q$key entries <- list.files(dir, full.names = TRUE) el_load_children( id = "files", request = q, children = lapply(entries, function(f) { list(id = f, label = basename(f), leaf = !dir.exists(f)) }) ) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) ui <- el_page(el_tree( "files", lazy = TRUE, node_key = "id", props = list(isLeaf = "leaf") )) server <- function(input, output, session) { observeEvent(input$files_load, { q <- input$files_load dir <- if (q$level == 0) "~" else q$key entries <- list.files(dir, full.names = TRUE) el_load_children( id = "files", request = q, children = lapply(entries, function(f) { list(id = f, label = basename(f), leaf = !dir.exists(f)) }) ) }) } shinyApp(ui, server) }
Cover the page, or one element, while something is being worked out.
Each mask is named, and stays until el_loading_close() is called with the
same id.
el_loading( session = shiny::getDefaultReactiveDomain(), id = "default", text = NULL, target = NULL, fullscreen = NULL, lock = NULL, body = NULL, spinner = NULL, background = NULL, custom_class = NULL, svg = NULL, svg_view_box = NULL, before_close = NULL )el_loading( session = shiny::getDefaultReactiveDomain(), id = "default", text = NULL, target = NULL, fullscreen = NULL, lock = NULL, body = NULL, spinner = NULL, background = NULL, custom_class = NULL, svg = NULL, svg_view_box = NULL, before_close = NULL )
session |
Shiny session; the current one by default, as for
|
id |
Name for this mask, used to close it again. |
text |
Text shown under the spinner. |
target |
CSS selector of the element to cover. |
fullscreen |
Whether the mask covers the viewport. Default |
lock |
Whether to stop the page scrolling underneath. |
body |
Whether the mask is inserted into |
spinner |
Class name of a custom spinner. |
background |
Background colour of the mask. |
custom_class |
Extra class name. |
svg, svg_view_box
|
A spinner of your own, as SVG path markup and its
|
before_close |
|
Called for its side effect; returns NULL invisibly.
input$<id>_closed – fires once the mask has closed.
if (interactive()) { library(shiny) library(shiny.element) ui <- el_page(el_button("go", "Fetch"), el_table("out")) server <- function(input, output, session) { observeEvent(input$go, { el_loading(session, "fetching", text = "Fetching rows...") on.exit(el_loading_close(session, "fetching"), add = TRUE) update_el_table(session, "out", data = slow_query()) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny.element) ui <- el_page(el_button("go", "Fetch"), el_table("out")) server <- function(input, output, session) { observeEvent(input$go, { el_loading(session, "fetching", text = "Fetching rows...") on.exit(el_loading_close(session, "fetching"), add = TRUE) update_el_table(session, "out", data = slow_query()) }) } shinyApp(ui, server) }
Closes the mask el_loading() opened under this id. Closing one that is
not open does nothing.
el_loading_close(session = shiny::getDefaultReactiveDomain(), id = "default")el_loading_close(session = shiny::getDefaultReactiveDomain(), id = "default")
session |
Shiny session; the current one by default, as for
|
id |
The |
Called for its side effect; returns NULL invisibly.
if (interactive()) { # inside a server function observeEvent(input$done, { el_loading_close(session, "fetching") }) }if (interactive()) { # inside a server function observeEvent(input$done, { el_loading_close(session, "fetching") }) }
Element Plus's own build is in English: a pagination control's total, a
date picker's buttons, a select's placeholder, a table's empty message.
Loading a locale file and handing it to Element Plus, as
app.use(ElementPlus, {locale}) does, switches all of it.
el_locale_dependency(locale = NULL)el_locale_dependency(locale = NULL)
locale |
Language to switch to, such as |
All 67 of Element Plus's locales are bundled; el_locales() lists them.
The ones used most – English, Chinese, Japanese, Korean, French, German,
Spanish, Portuguese (Brazil), Russian – are files; the others are packed
in one archive and taken out the first time one is used in a session.
Codes are matched without regard to case, so Element UI's "zh-CN" is
Element Plus's "zh-cn".
A list of htmlDependency objects, or NULL for the built-in locale.
el_locales() # English is Element Plus's own el_page(el_select("city", choices = c("Beijing", "Shanghai"))) # Anything Element Plus ships el_page(locale = "ja", el_select("city", choices = c("Beijing", "Shanghai"))) # Or set it for the whole session, here undone afterwards old <- options(shiny.element.locale = "zh-cn") el_page(el_select("city", choices = c("Beijing", "Shanghai"))) options(old)el_locales() # English is Element Plus's own el_page(el_select("city", choices = c("Beijing", "Shanghai"))) # Anything Element Plus ships el_page(locale = "ja", el_select("city", choices = c("Beijing", "Shanghai"))) # Or set it for the whole session, here undone afterwards old <- options(shiny.element.locale = "zh-cn") el_page(el_select("city", choices = c("Beijing", "Shanghai"))) options(old)
Collapse Handler Dependency Languages Element Plus can use for its built-in text
el_locales()el_locales()
A character vector of locale codes, such as "en" and "zh-TW",
any of which can be passed as locale to el_page().
el_locales()el_locales()
Element Plus Main
el_main(..., style = NULL, class = NULL)el_main(..., style = NULL, class = NULL)
... |
Content. |
style |
Extra inline style. |
class |
Extra CSS classes. |
A Shiny UI element.
el_main("Body content") el_main(el_table(data = head(iris, 3)))el_main("Body content") el_main(el_table(data = head(iris, 3)))
A text input that offers options after a trigger character, as @mentions do.
el_mention( id = NULL, value = NULL, options = NULL, props = NULL, prefix = NULL, split = NULL, filter_option = NULL, placement = NULL, show_arrow = NULL, offset = NULL, whole = NULL, check_is_whole = NULL, loading = NULL, popper_class = NULL, popper_style = NULL, popper_options = NULL, placeholder = NULL, disabled = NULL, type = NULL, rows = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_mention( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, options = NULL, props = NULL, prefix = NULL, split = NULL, filter_option = NULL, placement = NULL, show_arrow = NULL, offset = NULL, whole = NULL, check_is_whole = NULL, loading = NULL, popper_class = NULL, popper_style = NULL, popper_options = NULL, placeholder = NULL, type = NULL, rows = NULL )el_mention( id = NULL, value = NULL, options = NULL, props = NULL, prefix = NULL, split = NULL, filter_option = NULL, placement = NULL, show_arrow = NULL, offset = NULL, whole = NULL, check_is_whole = NULL, loading = NULL, popper_class = NULL, popper_style = NULL, popper_options = NULL, placeholder = NULL, disabled = NULL, type = NULL, rows = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_mention( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, options = NULL, props = NULL, prefix = NULL, split = NULL, filter_option = NULL, placement = NULL, show_arrow = NULL, offset = NULL, whole = NULL, check_is_whole = NULL, loading = NULL, popper_class = NULL, popper_style = NULL, popper_options = NULL, placeholder = NULL, type = NULL, rows = NULL )
id |
Component ID. Auto-generated if |
value |
Input value: Element Plus's |
options |
The options: a named vector |
props |
Configuration options. Element Plus's |
prefix |
Prefix character to trigger mentions. The string length must
be exactly 1. Element Plus's |
split |
Character to split mentions. The string length must be exactly
|
filter_option |
Customize filter option logic. Element Plus's
|
placement |
Set popup placement. Element Plus's |
show_arrow |
Whether the dropdown panel has an arrow. Element Plus's
|
offset |
Offset of the dropdown panel. Element Plus's |
whole |
When backspace is pressed to delete, whether the mention
content is deleted as a whole. Element Plus's |
check_is_whole |
When backspace is pressed to delete, check if the
mention is a whole. Element Plus's |
loading |
Whether the dropdown panel of mentions is in a loading
state. Element Plus's |
popper_class |
Custom class name for dropdown panel. Element Plus's
|
popper_style |
Custom style for dropdown panel. Element Plus's
|
popper_options |
Popper.js parameters. Element Plus's |
placeholder, disabled, type, rows
|
As for |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents: |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the text |
input$<id>_search |
unasked | list(pattern, prefix); answer with update_el_mention(options =) |
input$<id>_select |
unasked | list(option, prefix) |
input$<id>_whole_remove |
events = "whole_remove" |
list(pattern, prefix)
|
The same list as el_events("el_mention"), which says how an event's arguments travel.
Server-side update for el_mention().
Every other argument of el_mention() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_mention() is called for its side effect and returns NULL invisibly.
el_mention("msg", options = c("Ada", "Grace", "Linus"), placeholder = "Type @") if (interactive()) { # inside a server function observeEvent(input$reset, update_el_mention(session, "x", value = NULL)) }el_mention("msg", options = c("Ada", "Grace", "Linus"), placeholder = "Type @") if (interactive()) { # inside a server function observeEvent(input$reset, update_el_mention(session, "x", value = NULL)) }
Server-side function to show a top-centre message toast.
Requires use_element() or el_page() in the UI to load the JS handler.
el_message( session = shiny::getDefaultReactiveDomain(), message, type = "info", duration = 3000, show_close = FALSE, offset = 16, custom_class = NULL, dangerously_use_html_string = FALSE, id = NULL, icon = NULL, plain = NULL, placement = NULL, append_to = NULL, grouping = NULL, repeat_num = NULL )el_message( session = shiny::getDefaultReactiveDomain(), message, type = "info", duration = 3000, show_close = FALSE, offset = 16, custom_class = NULL, dangerously_use_html_string = FALSE, id = NULL, icon = NULL, plain = NULL, placement = NULL, append_to = NULL, grouping = NULL, repeat_num = NULL )
session |
Shiny session; the current one by default, as for
|
message |
Message text, or a VNode built in the browser: |
type |
Message type: |
duration |
Auto-close delay in milliseconds. |
show_close |
Whether to show the close button. Default |
offset |
Distance from the edge of the window, in pixels. Default |
custom_class |
Extra class name. |
dangerously_use_html_string |
Whether |
id |
Name for this message, so |
icon |
Icon to show instead of the one |
plain |
Whether it is drawn plain, without a background colour. |
placement |
Where it appears: |
append_to |
CSS selector of the element it is appended to. Default
|
grouping |
Whether identical messages shown together are merged into one, with a count. |
repeat_num |
The count a grouped message starts from. |
A Shiny UI element.
if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_button("btn", "Message", type = "primary") ) server <- function(input, output, session) { observeEvent(input$btn, { el_message( session, message = "This is a message toast.", type = "warning" ) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_button("btn", "Message", type = "primary") ) server <- function(input, output, session) { observeEvent(input$btn, { el_message( session, message = "This is a message toast.", type = "warning" ) }) } shinyApp(ui, server) }
A modal that asks something and waits for an answer: a confirmation, an acknowledgement, or a line of text.
el_message_box( session = shiny::getDefaultReactiveDomain(), id, message, title = NULL, type = NULL, box_type = c("confirm", "alert", "prompt"), confirm_button_text = NULL, cancel_button_text = NULL, show_cancel_button = NULL, show_close = NULL, center = FALSE, round_button = FALSE, dangerously_use_html_string = FALSE, custom_class = NULL, close_on_click_modal = NULL, close_on_press_escape = NULL, input_placeholder = NULL, input_value = NULL, input_pattern = NULL, input_error_message = NULL, input_type = NULL, input_validator = NULL, show_input = NULL, show_confirm_button = NULL, confirm_button_class = NULL, cancel_button_class = NULL, distinguish_cancel_and_close = NULL, lock_scroll = NULL, close_on_hash_change = NULL, before_close = NULL, custom_style = NULL, icon = NULL, close_icon = NULL, confirm_button_type = NULL, cancel_button_type = NULL, confirm_button_loading_icon = NULL, cancel_button_loading_icon = NULL, autofocus = NULL, modal = NULL, modal_class = NULL, draggable = NULL, overflow = NULL, button_size = NULL, append_to = NULL )el_message_box( session = shiny::getDefaultReactiveDomain(), id, message, title = NULL, type = NULL, box_type = c("confirm", "alert", "prompt"), confirm_button_text = NULL, cancel_button_text = NULL, show_cancel_button = NULL, show_close = NULL, center = FALSE, round_button = FALSE, dangerously_use_html_string = FALSE, custom_class = NULL, close_on_click_modal = NULL, close_on_press_escape = NULL, input_placeholder = NULL, input_value = NULL, input_pattern = NULL, input_error_message = NULL, input_type = NULL, input_validator = NULL, show_input = NULL, show_confirm_button = NULL, confirm_button_class = NULL, cancel_button_class = NULL, distinguish_cancel_and_close = NULL, lock_scroll = NULL, close_on_hash_change = NULL, before_close = NULL, custom_style = NULL, icon = NULL, close_icon = NULL, confirm_button_type = NULL, cancel_button_type = NULL, confirm_button_loading_icon = NULL, cancel_button_loading_icon = NULL, autofocus = NULL, modal = NULL, modal_class = NULL, draggable = NULL, overflow = NULL, button_size = NULL, append_to = NULL )
session |
Shiny session; the current one by default, as for
|
id |
Input ID the answer is reported to. |
message |
The question or statement, or a VNode built in the
browser: |
title |
Title of the box. |
type |
Icon shown: |
box_type |
|
confirm_button_text, cancel_button_text
|
Button labels. |
show_cancel_button |
Whether to offer a cancel button. Default |
show_close |
Whether to show the close cross. Default |
center |
Whether to centre the content. |
round_button |
Whether the buttons are rounded. |
dangerously_use_html_string |
Whether |
custom_class |
Extra class name. |
close_on_click_modal |
Whether clicking the backdrop closes it. |
close_on_press_escape |
Whether Escape closes it. |
input_placeholder, input_value
|
For |
input_pattern |
Regular expression the text must match, as a string. |
input_error_message |
Message shown when it does not match. |
input_type |
For a prompt, the input's type, such as |
input_validator |
For a prompt, |
show_input |
Whether to show a text input, as a prompt does. |
show_confirm_button |
Whether to show the confirm button. |
confirm_button_class, cancel_button_class
|
Extra class names for the buttons. |
distinguish_cancel_and_close |
Whether closing by the cross or Escape
reports |
lock_scroll |
Whether the page stops scrolling while the box is open. |
close_on_hash_change |
Whether a change of the URL hash closes it. |
before_close |
|
custom_style |
CSS for the box, a string or a named list. |
icon, close_icon
|
The icon shown instead of the one |
confirm_button_type, cancel_button_type
|
The buttons' types, as
|
confirm_button_loading_icon, cancel_button_loading_icon
|
The buttons' loading icons, by name. |
autofocus |
Whether the box takes focus when it opens. Default |
modal |
Whether it has a backdrop. Default |
modal_class |
Extra class name for the backdrop. |
draggable |
Whether it can be dragged by its header. |
overflow |
With |
button_size |
The buttons' size: |
append_to |
CSS selector of the element it is appended to. Default
|
Unlike el_message() and el_notification(), this one answers back. The
reply arrives as input$<id>, so read it with observeEvent(): the input
is set with event priority, so answering "confirm" twice in a row fires the
observer twice, where an output reading the value would see no change.
Called for its side effect; returns NULL invisibly.
input$<id> – "confirm", "cancel" or "close". For a prompt that
was confirmed, a list of action and value, where value is the text
the user typed.
if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_button("del", "Delete", type = "danger"), verbatimTextOutput("answer") ) server <- function(input, output, session) { observeEvent(input$del, { el_message_box( session, "confirm_delete", "This cannot be undone.", title = "Delete the row?", type = "warning" ) }) observeEvent(input$confirm_delete, { output$answer <- renderPrint(input$confirm_delete) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_button("del", "Delete", type = "danger"), verbatimTextOutput("answer") ) server <- function(input, output, session) { observeEvent(input$del, { el_message_box( session, "confirm_delete", "This cannot be undone.", title = "Delete the row?", type = "warning" ) }) observeEvent(input$confirm_delete, { output$answer <- renderPrint(input$confirm_delete) }) } shinyApp(ui, server) }
Server-side function to show a desktop-corner notification popup.
Requires use_element() or el_page() in the UI to load the JS handler.
el_notification( session = shiny::getDefaultReactiveDomain(), message, title = "", type = "info", duration = 4500, position = "top-right", show_close = TRUE, offset = 0, custom_class = NULL, dangerously_use_html_string = FALSE, id = NULL, icon = NULL, append_to = NULL, z_index = NULL, close_icon = NULL, progress = NULL, pause_on_hover = NULL )el_notification( session = shiny::getDefaultReactiveDomain(), message, title = "", type = "info", duration = 4500, position = "top-right", show_close = TRUE, offset = 0, custom_class = NULL, dangerously_use_html_string = FALSE, id = NULL, icon = NULL, append_to = NULL, z_index = NULL, close_icon = NULL, progress = NULL, pause_on_hover = NULL )
session |
Shiny session; the current one by default, as for
|
message |
Notification body text, or a VNode built in the browser:
|
title |
Notification title. Default |
type |
Notification type: |
duration |
Auto-close delay in milliseconds. |
position |
Screen corner: |
show_close |
Whether to show the close button. Default |
offset |
Distance from the corner edge in pixels. Default |
custom_class |
Extra class name. |
dangerously_use_html_string |
Whether |
id |
Name for this notification, so |
icon |
Icon to show instead of the one |
append_to |
CSS selector of the element it is appended to. Default
|
z_index |
Its z-index, instead of the next one Element Plus hands out. |
close_icon |
The close button's icon, by name. |
progress |
Show a bar counting down |
pause_on_hover |
Whether the countdown stops while the pointer is
over it. Default |
A Shiny UI element.
if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_button("btn", "Notify", type = "primary") ) server <- function(input, output, session) { observeEvent(input$btn, { el_notification( session, message = "Operation successful!", title = "Success", type = "success" ) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_button("btn", "Notify", type = "primary") ) server <- function(input, output, session) { observeEvent(input$btn, { el_notification( session, message = "Operation successful!", title = "Success", type = "success" ) }) } shinyApp(ui, server) }
Element Plus's el-option and el-option-group, for the choices of
el_select() and the other choice components – where a named vector
cannot say that one choice is disabled, or that choices come in groups.
el_option(label, value = label, disabled = NULL) el_option_group(label, ..., disabled = NULL)el_option(label, value = label, disabled = NULL) el_option_group(label, ..., disabled = NULL)
label |
The text shown. |
value |
The value reported when it is chosen. Defaults to |
disabled |
Whether it can be chosen; for a group, whether any of its choices can. |
... |
The group's choices, each an |
A choice, or a group of them, for choices =.
Other items:
el_anchor_link(),
el_breadcrumb_item(),
el_carousel_item(),
el_collapse_item(),
el_descriptions_item(),
el_dropdown_item(),
el_menu_item(),
el_skeleton_item(),
el_step(),
el_tab_pane(),
el_table_column(),
el_table_v2_column(),
el_timeline_item(),
el_tour_step()
el_select( "city", choices = list( el_option_group( "Popular cities", el_option("Shanghai"), el_option("Beijing", disabled = TRUE) ), el_option_group("City name", el_option("Chengdu"), el_option("Dalian")) ) )el_select( "city", choices = list( el_option_group( "Popular cities", el_option("Shanghai"), el_option("Beijing", disabled = TRUE) ), el_option_group("City name", el_option("Chengdu"), el_option("Dalian")) ) )
Top-level page constructor that loads Element-UI, Vue, and layout CSS dependencies, and supports both bslib/shiny themes and Element-UI layout CSS.
el_page( ..., title = NULL, theme = el_theme(), theme_css = el_layout_css_dependency(), offline = TRUE, locale = getOption("shiny.element.locale", "en"), dev = .vue_dev(), size = NULL, z_index = NULL )el_page( ..., title = NULL, theme = el_theme(), theme_css = el_layout_css_dependency(), offline = TRUE, locale = getOption("shiny.element.locale", "en"), dev = .vue_dev(), size = NULL, z_index = NULL )
... |
UI elements to include in the page body. |
title |
Optional page title. |
theme |
Bootstrap theme for the rest of the page: a
|
theme_css |
Element's layout CSS, |
offline |
Serve Element Plus from the copy bundled with this package
rather than the unpkg CDN. See |
locale |
Language for Element Plus's built-in text – pagination
summaries, date-picker buttons, select placeholders. English by default,
or |
dev |
Load Vue's development build ( |
size, z_index
|
Element Plus's global config, as |
Use this as the root UI function for your Shiny app. You can combine bslib layouts
(such as page_sidebar, layout_columns) and Element components (such as el_button).
Element's layout (el_container(), el_row(), el_col()) and bslib's
(page_sidebar(), layout_columns()) each work here; nest one inside a
cell of the other rather than interleaving them.
A page returned by shiny::renderUI() works there too. Like Shiny's and
bslib's page functions it is a whole page, not one tag, so shinyjs's
hidden() cannot wrap it: hide its output instead –
shinyjs::hidden(uiOutput("id")), or shinyjs::hide("id") later.
Inside renderUI() the components alone are enough: each brings what it
needs.
A Shiny UI element.
el_page( title = "My app", el_input("name", value = "Ada"), el_button("go", "Submit", type = "primary") ) # English component text, and Vue's development build for debugging el_page(locale = "en", dev = TRUE, el_input("name"))el_page( title = "My app", el_input("name", value = "Ada"), el_button("go", "Submit", type = "primary") ) # English component text, and Vue's development build for debugging el_page(locale = "en", dev = TRUE, el_input("name"))
A page title with a back link.
el_page_header( id = NULL, title = NULL, content = NULL, icon = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_page_header( session = shiny::getDefaultReactiveDomain(), id, title = NULL, content = NULL, icon = NULL )el_page_header( id = NULL, title = NULL, content = NULL, icon = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_page_header( session = shiny::getDefaultReactiveDomain(), id, title = NULL, content = NULL, icon = NULL )
id |
Header ID. Auto-generated if |
title |
Text of the back link. Default |
content |
The page's own title, shown after the separator. |
icon |
Icon component of page header. Element Plus's |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
| Input | Reported | Value |
input$<id>_back |
unasked | triggers when right side is clicked |
The same list as el_events("el_page_header"), which says how an event's arguments travel.
Server-side update for el_page_header().
Every other argument of el_page_header() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_page_header() is called for its side effect and returns NULL invisibly.
el_page_header("hdr", content = "Sales for March") el_page_header("hdr", title = "All reports", content = "Sales for March") if (interactive()) { library(shiny) ui <- el_page( el_page_header("hdr", content = "Detail"), verbatimTextOutput("where") ) server <- function(input, output, session) { output$where <- renderPrint(input$hdr_back) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$row_click, { update_el_page_header(session, "hdr", content = selected_name()) }) }el_page_header("hdr", content = "Sales for March") el_page_header("hdr", title = "All reports", content = "Sales for March") if (interactive()) { library(shiny) ui <- el_page( el_page_header("hdr", content = "Detail"), verbatimTextOutput("where") ) server <- function(input, output, session) { output$where <- renderPrint(input$hdr_back) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$row_click, { update_el_page_header(session, "hdr", content = selected_name()) }) }
Creates an Element Plus pagination bar with page navigation, size selector, jump-to-page input, and total count display.
el_pagination( id = NULL, total, page_size = 10, current_page = 1, page_sizes = c(10, 20, 30, 50), layout = "total, sizes, prev, pager, next, jumper", background = FALSE, small = FALSE, disabled = FALSE, pager_count = 7, prev_text = NULL, next_text = NULL, hide_on_single_page = NULL, page_count = NULL, popper_class = NULL, append_size_to = NULL, default_current_page = NULL, default_page_size = NULL, next_icon = NULL, popper_style = NULL, prev_icon = NULL, size = NULL, teleported = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_pagination( session = shiny::getDefaultReactiveDomain(), id, total = NULL, current_page = NULL, page_size = NULL, disabled = NULL, page_sizes = NULL, layout = NULL, background = NULL, small = NULL, pager_count = NULL, prev_text = NULL, next_text = NULL, hide_on_single_page = NULL, page_count = NULL, popper_class = NULL, append_size_to = NULL, next_icon = NULL, popper_style = NULL, prev_icon = NULL, size = NULL, teleported = NULL )el_pagination( id = NULL, total, page_size = 10, current_page = 1, page_sizes = c(10, 20, 30, 50), layout = "total, sizes, prev, pager, next, jumper", background = FALSE, small = FALSE, disabled = FALSE, pager_count = 7, prev_text = NULL, next_text = NULL, hide_on_single_page = NULL, page_count = NULL, popper_class = NULL, append_size_to = NULL, default_current_page = NULL, default_page_size = NULL, next_icon = NULL, popper_style = NULL, prev_icon = NULL, size = NULL, teleported = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_pagination( session = shiny::getDefaultReactiveDomain(), id, total = NULL, current_page = NULL, page_size = NULL, disabled = NULL, page_sizes = NULL, layout = NULL, background = NULL, small = NULL, pager_count = NULL, prev_text = NULL, next_text = NULL, hide_on_single_page = NULL, page_count = NULL, popper_class = NULL, append_size_to = NULL, next_icon = NULL, popper_style = NULL, prev_icon = NULL, size = NULL, teleported = NULL )
id |
Pagination ID. Auto-generated UUID if |
total |
Total item count (required). |
page_size |
Items per page. Default |
current_page |
Current page number (1-based). Default |
page_sizes |
Vector of page-size options. Default |
layout |
Comma-separated list of layout elements.
Default |
background |
Whether to use background colour on page buttons. Default |
small |
Whether to use compact (small) mode. Default |
disabled |
Whether the pagination is disabled. Default |
pager_count |
Number of pager buttons to show. Default |
prev_text |
Text of the previous-page button, in place of the arrow icon. |
next_text |
Text of the next-page button, in place of the arrow icon. |
hide_on_single_page |
Whether to hide the pager when there is only one page. |
page_count |
Total page count. Set either this or |
popper_class |
Extra class name for the page-size dropdown. |
append_size_to |
Which element the size dropdown appends to. Element
Plus's |
default_current_page |
Default initial value of current-page, not
setting is the same as setting 1. Element Plus's |
default_page_size |
Default initial value of page size, not setting is
the same as setting 10. Element Plus's |
next_icon |
Icon for the next button, has a lower priority than
|
popper_style |
Custom style for the page size Select's dropdown.
Element Plus's |
prev_icon |
Icon for the prev button, has a lower priority than
|
size |
Pagination size. Element Plus's |
teleported |
Whether Pagination select dropdown is teleported to the
body. Element Plus's |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList with a Vue-managed pagination component.
| Input | Reported | Value |
input$<id> |
unasked | the current page, from 1 |
input$<id>_page_size |
unasked | the page size |
input$<id>_prev_click |
events = "prev_click" |
triggers when the prev button is clicked and current page changes |
input$<id>_next_click |
events = "next_click" |
triggers when the next button is clicked and current page changes |
input$<id>_change |
events = "change" |
triggers when current-page or page-size changes |
The same list as el_events("el_pagination"), which says how an event's arguments travel.
Server-side update for el_pagination().
Every other argument of el_pagination() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_pagination() is called for its side effect and returns NULL invisibly.
# Basic usage el_pagination("pg1", total = 100) # With custom page sizes and layout el_pagination( "pg2", total = 500, page_size = 20, page_sizes = c(10, 20, 50, 100), layout = "total, sizes, prev, pager, next" ) # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_pagination("pg1", total = 200), verbatimTextOutput("page_info") ) server <- function(input, output, session) { output$page_info <- renderPrint({ list(page = input$pg1, size = input$pg1_page_size) }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_pagination(session, "pager", current_page = 2) }) }# Basic usage el_pagination("pg1", total = 100) # With custom page sizes and layout el_pagination( "pg2", total = 500, page_size = 20, page_sizes = c(10, 20, 50, 100), layout = "total, sizes, prev, pager, next" ) # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_pagination("pg1", total = 200), verbatimTextOutput("page_info") ) server <- function(input, output, session) { output$page_info <- renderPrint({ list(page = input$pg1, size = input$pg1_page_size) }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_pagination(session, "pager", current_page = 2) }) }
A small confirmation prompt anchored to the element that triggers it, for actions that warrant a check but not a dialog.
el_popconfirm( id = NULL, reference = NULL, title = NULL, confirm_button_text = NULL, cancel_button_text = NULL, confirm_button_type = NULL, cancel_button_type = NULL, icon = NULL, icon_color = NULL, hide_icon = NULL, effect = NULL, hide_after = NULL, persistent = NULL, teleported = NULL, popconfirm_width = NULL, ..., width = NULL, slots = NULL, on = NULL, session = NULL, placement = NULL ) update_el_popconfirm( session = shiny::getDefaultReactiveDomain(), id, title = NULL, confirm_button_text = NULL, cancel_button_text = NULL )el_popconfirm( id = NULL, reference = NULL, title = NULL, confirm_button_text = NULL, cancel_button_text = NULL, confirm_button_type = NULL, cancel_button_type = NULL, icon = NULL, icon_color = NULL, hide_icon = NULL, effect = NULL, hide_after = NULL, persistent = NULL, teleported = NULL, popconfirm_width = NULL, ..., width = NULL, slots = NULL, on = NULL, session = NULL, placement = NULL ) update_el_popconfirm( session = shiny::getDefaultReactiveDomain(), id, title = NULL, confirm_button_text = NULL, cancel_button_text = NULL )
id |
Popconfirm ID. Auto-generated if |
reference |
The element that opens the prompt. Any Shiny UI,
including another shiny.element component – that component is folded
into this one's Vue instance rather than nested inside it, so its inputs
keep reporting. Its |
title |
The question. |
confirm_button_text, cancel_button_text
|
Button labels. |
confirm_button_type, cancel_button_type
|
Button types, as in
|
icon |
Icon class shown beside the question. |
icon_color |
Colour of that icon. |
hide_icon |
Whether to leave the icon out. Default |
effect |
Tooltip theme, built-in theme: |
hide_after |
Delay of disappear, in millisecond. Element Plus's
|
persistent |
When popconfirm inactive and |
teleported |
Whether popconfirm is teleported to the body. Element
Plus's |
popconfirm_width |
Width of the prompt: pixels, or a CSS width; at
least 150px. Element Plus's |
... |
Any other attribute of Element Plus's tooltip, which the popconfirm
inherits, in snake_case: |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents, such as
|
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
placement |
Where the popup goes: |
A Shiny UI element.
| Input | Reported | Value |
input$<id>_confirm |
unasked | fires when the user confirms |
input$<id>_cancel |
unasked | fires when the user backs out |
The same list as el_events("el_popconfirm"), which says how an event's arguments travel.
Server-side update for el_popconfirm().
update_el_popconfirm() is called for its side effect and returns NULL invisibly.
el_popconfirm( "del", reference = el$button(type = "danger", "Delete"), title = "Delete this row?" ) if (interactive()) { library(shiny) ui <- el_page( el_popconfirm( "del", reference = el$button(type = "danger", "Delete"), title = "Delete this row?" ) ) server <- function(input, output, session) { observeEvent(input$del_confirm, { showNotification("Deleted") }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$row_click, { update_el_popconfirm( session, "del", title = paste0("Delete ", selected_name(), "?") ) }) }el_popconfirm( "del", reference = el$button(type = "danger", "Delete"), title = "Delete this row?" ) if (interactive()) { library(shiny) ui <- el_page( el_popconfirm( "del", reference = el$button(type = "danger", "Delete"), title = "Delete this row?" ) ) server <- function(input, output, session) { observeEvent(input$del_confirm, { showNotification("Deleted") }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$row_click, { update_el_popconfirm( session, "del", title = paste0("Delete ", selected_name(), "?") ) }) }
A card shown on click or hover, with a title and body.
el_popover( id = NULL, reference = NULL, title = NULL, content = NULL, body = NULL, trigger = NULL, placement = NULL, popover_width = NULL, disabled = NULL, offset = NULL, transition = NULL, popper_class = NULL, popper_options = NULL, tabindex = NULL, append_to = NULL, auto_close = NULL, effect = NULL, hide_after = NULL, persistent = NULL, popper_style = NULL, show_after = NULL, show_arrow = NULL, teleported = NULL, trigger_keys = NULL, virtual_ref = NULL, virtual_triggering = NULL, visible = NULL, ..., width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_popover( session = shiny::getDefaultReactiveDomain(), id, title = NULL, content = NULL, disabled = NULL, visible = NULL )el_popover( id = NULL, reference = NULL, title = NULL, content = NULL, body = NULL, trigger = NULL, placement = NULL, popover_width = NULL, disabled = NULL, offset = NULL, transition = NULL, popper_class = NULL, popper_options = NULL, tabindex = NULL, append_to = NULL, auto_close = NULL, effect = NULL, hide_after = NULL, persistent = NULL, popper_style = NULL, show_after = NULL, show_arrow = NULL, teleported = NULL, trigger_keys = NULL, virtual_ref = NULL, virtual_triggering = NULL, visible = NULL, ..., width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_popover( session = shiny::getDefaultReactiveDomain(), id, title = NULL, content = NULL, disabled = NULL, visible = NULL )
id |
Popover ID. Auto-generated if |
reference |
The element the popover hangs off. Any Shiny UI,
including another shiny.element component – that component is folded
into the popover's Vue instance rather than nested inside it, so its
inputs keep reporting. Its |
title |
Title of the card. |
content |
Body text. For richer content pass |
body |
Body markup, used instead of |
trigger |
How it opens: |
placement |
Where it appears: |
popover_width |
Width of the card, in pixels. Element's own |
disabled |
Whether the popover is suppressed. |
offset |
Offset from the reference, in pixels. |
transition |
Name of the transition to animate with. |
popper_class |
Extra class name for the card. |
popper_options |
Additional Popper.js options, as a named list. |
tabindex |
Tabindex of Popover. Element Plus's |
append_to |
Which element the popover CONTENT appends to. Element
Plus's |
auto_close |
Timeout in milliseconds to hide tooltip, not valid in
controlled mode. Element Plus's |
effect |
Tooltip theme, built-in theme: |
hide_after |
Delay of disappear, in millisecond, not valid in
controlled mode. Element Plus's |
persistent |
When popover inactive and |
popper_style |
Custom style for popover. Element Plus's |
show_after |
Delay of appearance, in millisecond, not valid in
controlled mode. Element Plus's |
show_arrow |
Whether a tooltip arrow is displayed or not. For more
info, please refer to ElPopper. Element Plus's |
teleported |
Whether popover dropdown is teleported to the body.
Element Plus's |
trigger_keys |
When you click the mouse to focus on the trigger
element, you can define a set of keyboard codes to control the display of
popover through the keyboard, not valid in controlled mode. Element
Plus's |
virtual_ref |
A CSS selector, |
virtual_triggering |
Whether virtual triggering is enabled. Element
Plus's |
visible |
Whether popover is visible. Element Plus's |
... |
Any other attribute of Element Plus's tooltip, which the popover
inherits, in snake_case: |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
| Input | Reported | Value |
input$<id>_show |
events = "show" |
triggers when popover shows |
input$<id>_hide |
events = "hide" |
triggers when popover hides |
input$<id>_after_enter |
events = "after_enter" |
triggers when the entering transition ends |
input$<id>_after_leave |
events = "after_leave" |
triggers when the leaving transition ends |
input$<id>_before_enter |
events = "before_enter" |
triggers when the entering transition before |
input$<id>_before_leave |
events = "before_leave" |
triggers when the leaving transition before |
The same list as el_events("el_popover"), which says how an event's arguments travel.
Server-side update for el_popover(). Setting visible opens or closes
the card, which then stays as set: Element Plus's popover is controlled by
its visible once that is given.
update_el_popover() is called for its side effect and returns NULL invisibly.
el_popover( "info", reference = el$button("Details"), title = "March", content = "Revenue up 4% on February." ) # Hover, with markup in the body el_popover( "info", reference = el$button("Details"), body = shiny::tags$ul(shiny::tags$li("One"), shiny::tags$li("Two")), trigger = "hover", placement = "right" ) if (interactive()) { # inside a server function observeEvent(input$explain, { update_el_popover(session, "info", content = summary_text(), visible = TRUE) }) }el_popover( "info", reference = el$button("Details"), title = "March", content = "Revenue up 4% on February." ) # Hover, with markup in the body el_popover( "info", reference = el$button("Details"), body = shiny::tags$ul(shiny::tags$li("One"), shiny::tags$li("Two")), trigger = "hover", placement = "right" ) if (interactive()) { # inside a server function observeEvent(input$explain, { update_el_popover(session, "info", content = summary_text(), visible = TRUE) }) }
Creates an Element Plus progress bar. This is a display-only component;
update it from the server with update_el_progress().
el_progress( id = NULL, percentage = 0, type = "line", status = NULL, stroke_width = 6, text_inside = FALSE, show_text = TRUE, color = NULL, width = 126, stroke_linecap = NULL, slots = NULL, format = NULL, duration = NULL, indeterminate = NULL, striped = NULL, striped_flow = NULL, on = NULL, session = NULL ) update_el_progress( session = shiny::getDefaultReactiveDomain(), id, percentage = NULL, type = NULL, status = NULL, color = NULL, stroke_width = NULL, show_text = NULL, text_inside = NULL, stroke_linecap = NULL, format = NULL, duration = NULL, indeterminate = NULL, striped = NULL, striped_flow = NULL )el_progress( id = NULL, percentage = 0, type = "line", status = NULL, stroke_width = 6, text_inside = FALSE, show_text = TRUE, color = NULL, width = 126, stroke_linecap = NULL, slots = NULL, format = NULL, duration = NULL, indeterminate = NULL, striped = NULL, striped_flow = NULL, on = NULL, session = NULL ) update_el_progress( session = shiny::getDefaultReactiveDomain(), id, percentage = NULL, type = NULL, status = NULL, color = NULL, stroke_width = NULL, show_text = NULL, text_inside = NULL, stroke_linecap = NULL, format = NULL, duration = NULL, indeterminate = NULL, striped = NULL, striped_flow = NULL )
id |
Progress ID. Auto-generated UUID if |
percentage |
Progress percentage, |
type |
Progress bar type: |
status |
Status theme: |
stroke_width |
Stroke width in pixels. Default |
text_inside |
Whether to display the percentage text inside the bar
(only applies to |
show_text |
Whether to show the progress text. Default |
color |
Custom colour string (e.g. |
width |
Width in pixels for |
stroke_linecap |
Shape of the bar's ends: |
slots |
Named list of Element slot contents, such as
|
format |
|
duration |
Control the animation duration of indeterminate progress or
striped flow progress. Element Plus's |
indeterminate |
Set indeterminate progress. Element Plus's
|
striped |
Stripe over the progress bar's color. Element Plus's
|
striped_flow |
Get the stripes to flow. Element Plus's |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList with a Vue-managed progress component.
Server-side update for el_progress().
Every other argument of el_progress() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
Unlike the other updates, which go with the flush (flush_vue()), it is
sent at once, as shiny::withProgress() reports: a loop updating it
shows every step.
update_el_progress() is called for its side effect and returns NULL invisibly.
# Basic line progress el_progress("prog1", percentage = 60) # Circle progress with success status el_progress("prog2", percentage = 100, type = "circle", status = "success") # Dashboard style with custom colour el_progress("prog3", percentage = 75, type = "dashboard", color = "#67C23A") # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_progress("prog1", percentage = 0), actionButton("go", "Advance") ) server <- function(input, output, session) { observeEvent(input$go, { update_el_progress( session, "prog1", percentage = min(100, (input$go * 10)) ) }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_progress(session, "pct", percentage = 100) }) }# Basic line progress el_progress("prog1", percentage = 60) # Circle progress with success status el_progress("prog2", percentage = 100, type = "circle", status = "success") # Dashboard style with custom colour el_progress("prog3", percentage = 75, type = "dashboard", color = "#67C23A") # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_progress("prog1", percentage = 0), actionButton("go", "Advance") ) server <- function(input, output, session) { observeEvent(input$go, { update_el_progress( session, "prog1", percentage = min(100, (input$go * 10)) ) }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_progress(session, "pct", percentage = 100) }) }
Creates an Element Plus <el-radio-group> component backed by a Vue instance.
Supports both standard radio buttons (<el-radio>) and button-style radios
(<el-radio-button>).
el_radio_group( id = NULL, choices = NULL, selected = NULL, disabled = FALSE, size = NULL, button = FALSE, fill = NULL, text_color = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, value = NULL, options = NULL, aria_label = NULL, props = NULL, type = NULL, validate_event = NULL, on = NULL, session = NULL ) update_el_radio_group( session = shiny::getDefaultReactiveDomain(), id, selected = NULL, choices = NULL, disabled = NULL, value = NULL, options = NULL, label = NULL, error = NULL, size = NULL, fill = NULL, text_color = NULL, aria_label = NULL, props = NULL, type = NULL, validate_event = NULL )el_radio_group( id = NULL, choices = NULL, selected = NULL, disabled = FALSE, size = NULL, button = FALSE, fill = NULL, text_color = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, value = NULL, options = NULL, aria_label = NULL, props = NULL, type = NULL, validate_event = NULL, on = NULL, session = NULL ) update_el_radio_group( session = shiny::getDefaultReactiveDomain(), id, selected = NULL, choices = NULL, disabled = NULL, value = NULL, options = NULL, label = NULL, error = NULL, size = NULL, fill = NULL, text_color = NULL, aria_label = NULL, props = NULL, type = NULL, validate_event = NULL )
id |
Input ID. Auto-generated UUID if |
choices, options
|
The choices: a named character vector
( |
selected, value
|
Initially selected value; nothing by default.
|
disabled |
Whether the entire group is disabled. Default |
size |
Size: |
button |
Whether to render as |
fill |
Border and background colour of a checked radio button. |
text_color |
Text colour of a checked radio button. |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
aria_label |
Same as |
props |
Configuration options. Element Plus's |
type |
Component type to render options (e.g. |
validate_event |
Whether to trigger form validation. Element Plus's
|
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList containing the Vue-managed radio group.
| Input | Reported | Value |
input$<id> |
unasked | the value picked |
The same list as el_events("el_radio_group"), which says how an event's arguments travel.
Server-side update for el_radio_group(). Sends a custom message to update
reactive fields on the underlying Vue instance.
Every other argument of el_radio_group() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_radio_group() is called for its side effect and returns NULL invisibly.
# Standard radio buttons from a named vector el_radio_group( "size", choices = c(Small = "s", Medium = "m", Large = "l"), selected = "m" ) # Button-style radio group el_radio_group( "theme", choices = c(Light = "light", Dark = "dark"), button = TRUE, size = "small" ) # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_radio_group( "fruit", choices = c(Apple = "apple", Banana = "banana", Cherry = "cherry"), selected = "apple" ), verbatimTextOutput("selected") ) server <- function(input, output, session) { output$selected <- renderPrint(input$fruit) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_radio_group(session, "plan", selected = "pro") }) }# Standard radio buttons from a named vector el_radio_group( "size", choices = c(Small = "s", Medium = "m", Large = "l"), selected = "m" ) # Button-style radio group el_radio_group( "theme", choices = c(Light = "light", Dark = "dark"), button = TRUE, size = "small" ) # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_radio_group( "fruit", choices = c(Apple = "apple", Banana = "banana", Cherry = "cherry"), selected = "apple" ), verbatimTextOutput("selected") ) server <- function(input, output, session) { output$selected <- renderPrint(input$fruit) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_radio_group(session, "plan", selected = "pro") }) }
A star-rating input. Supports half-stars, custom icons, and read-only display.
el_rate( id = NULL, value = 0, max = 5L, disabled = FALSE, allow_half = FALSE, show_text = FALSE, show_score = FALSE, texts = NULL, text_color = NULL, score_template = "{value}", colors = NULL, void_color = NULL, disabled_void_color = NULL, low_threshold = NULL, high_threshold = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, aria_label = NULL, clearable = NULL, disabled_void_icon = NULL, icons = NULL, size = NULL, void_icon = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_rate( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, max = NULL, allow_half = NULL, show_text = NULL, show_score = NULL, texts = NULL, text_color = NULL, score_template = NULL, void_color = NULL, disabled_void_color = NULL, low_threshold = NULL, high_threshold = NULL, aria_label = NULL, clearable = NULL, disabled_void_icon = NULL, icons = NULL, size = NULL, void_icon = NULL )el_rate( id = NULL, value = 0, max = 5L, disabled = FALSE, allow_half = FALSE, show_text = FALSE, show_score = FALSE, texts = NULL, text_color = NULL, score_template = "{value}", colors = NULL, void_color = NULL, disabled_void_color = NULL, low_threshold = NULL, high_threshold = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, aria_label = NULL, clearable = NULL, disabled_void_icon = NULL, icons = NULL, size = NULL, void_icon = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_rate( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, max = NULL, allow_half = NULL, show_text = NULL, show_score = NULL, texts = NULL, text_color = NULL, score_template = NULL, void_color = NULL, disabled_void_color = NULL, low_threshold = NULL, high_threshold = NULL, aria_label = NULL, clearable = NULL, disabled_void_icon = NULL, icons = NULL, size = NULL, void_icon = NULL )
id |
Rate ID. Auto-generated UUID if |
value |
Initial rating value. Default |
max |
Maximum number of stars. Default |
disabled |
Read-only display mode. Default |
allow_half |
Whether to allow half-star selection. Default |
show_text |
Whether to show descriptive text beside the stars. Uses the
|
show_score |
Whether to show the numeric score. Default |
texts |
Character vector of length |
text_color |
Colour of the text or score. |
score_template |
Template for score display. |
colors |
Colours for the three score levels, or a named list keyed by threshold. |
void_color |
Colour of unselected icons. |
disabled_void_color |
Colour of unselected icons when |
low_threshold |
Scores at or below this use the first colour and icon. Default |
high_threshold |
Scores above this use the third colour and icon. Default |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
aria_label |
Same as |
clearable |
Whether value can be reset to |
disabled_void_icon |
Component of unselected read-only icons. Element
Plus's |
icons |
Icon components. If array, it should have 3 elements, each of
which corresponds with a score level, else if object, the key should be
threshold value between two levels, and the value should be corresponding
icon component. Element Plus's |
size |
Size of Rate. Element Plus's |
void_icon |
Component of unselected icons. Element Plus's |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList with a Vue-managed rate component.
| Input | Reported | Value |
input$<id> |
unasked | the rating |
The same list as el_events("el_rate"), which says how an event's arguments travel.
Server-side update for el_rate().
Every other argument of el_rate() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_rate() is called for its side effect and returns NULL invisibly.
el_rate("rate1", value = 3) el_rate("rate2", allow_half = TRUE, show_score = TRUE) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_rate(session, "stars", value = 5) }) }el_rate("rate1", value = 3) el_rate("rate2", allow_half = TRUE, show_score = TRUE) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_rate(session, "stars", value = 5) }) }
The outcome of an operation: an icon, a title, a line of detail, and what to do next.
el_result( id = NULL, ..., icon = NULL, title = NULL, sub_title = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_result( session = shiny::getDefaultReactiveDomain(), id, icon = NULL, title = NULL, sub_title = NULL )el_result( id = NULL, ..., icon = NULL, title = NULL, sub_title = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_result( session = shiny::getDefaultReactiveDomain(), id, icon = NULL, title = NULL, sub_title = NULL )
id |
Component ID. Auto-generated if |
... |
What to do next, shown under the text – usually buttons. A shiny.element component here is absorbed, not nested, and keeps reporting its inputs. |
icon |
|
title |
Headline. |
sub_title |
Detail under the headline. |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
Server-side update for el_result().
update_el_result() is called for its side effect and returns NULL invisibly.
el_result( "done", icon = "success", title = "Report submitted", sub_title = "It will be reviewed within a day", el_button("back", "Back to the list", type = "primary") ) if (interactive()) { # inside a server function observeEvent(input$submit, { ok <- tryCatch( { save() TRUE }, error = function(e) FALSE ) update_el_result( session, "outcome", icon = if (ok) "success" else "error", title = if (ok) "Saved" else "Could not save" ) }) }el_result( "done", icon = "success", title = "Report submitted", sub_title = "It will be reviewed within a day", el_button("back", "Back to the list", type = "primary") ) if (interactive()) { # inside a server function observeEvent(input$submit, { ok <- tryCatch( { save() TRUE }, error = function(e) FALSE ) update_el_result( session, "outcome", icon = if (ok) "success" else "error", title = if (ok) "Saved" else "Could not save" ) }) }
Emits <div class="el-row"> directly rather than an <el-row> custom tag.
Nothing mounts a Vue instance over page-level markup, so a custom tag would
never be compiled and would render as an unstyled inline element; the
Element Plus stylesheet is already loaded, so the class name is all that is
needed.
el_row( ..., gutter = NULL, type = NULL, justify = NULL, align = NULL, tag = "div", class = NULL, style = NULL )el_row( ..., gutter = NULL, type = NULL, justify = NULL, align = NULL, tag = "div", class = NULL, style = NULL )
... |
Child columns ( |
gutter |
Spacing between columns, in pixels. |
type |
Element UI's |
justify |
Flex horizontal alignment: |
align |
Flex vertical alignment: |
tag |
HTML element to render, as Element's |
class |
Extra CSS classes. |
style |
Extra inline style. |
A Shiny UI element.
# Two equal columns with a 20px gutter el_row( gutter = 20, el_col(span = 12, "left"), el_col(span = 12, "right") ) # Centred row el_row( justify = "center", align = "middle", el_col(span = 8, "centred") )# Two equal columns with a 20px gutter el_row( gutter = 20, el_col(span = 12, "left"), el_col(span = 12, "right") ) # Centred row el_row( justify = "center", align = "middle", el_col(span = 8, "centred") )
Builds one async-validator rule, the format Element Plus's form expects.
el_rule( required = NULL, min = NULL, max = NULL, len = NULL, pattern = NULL, type = NULL, message = NULL, trigger = "blur", enum = NULL, whitespace = NULL, validator = NULL, transform = NULL )el_rule( required = NULL, min = NULL, max = NULL, len = NULL, pattern = NULL, type = NULL, message = NULL, trigger = "blur", enum = NULL, whitespace = NULL, validator = NULL, transform = NULL )
required |
Whether the field must be filled. |
min, max
|
Minimum and maximum: length for strings, value for numbers. |
len |
Exact length. |
pattern |
A regular expression the value must match. |
type |
Value type to check: |
message |
Text shown when the rule fails. |
trigger |
When to run the rule: |
enum |
Allowed values, with |
whitespace |
Whether a value of only whitespace counts as empty, with
|
validator |
A |
transform |
A |
A rule, for el_form_field()'s rules argument.
el_rule(required = TRUE, message = "Please enter your name") el_rule(type = "email", message = "Not a valid email", trigger = "blur") el_rule(type = "enum", enum = c("a", "b"), message = "a or b") # Element's custom validator el_rule( validator = JS( "function(rule, value, callback) {", " value % 2 === 0 ? callback() : callback(new Error('An even number'));", "}" ), trigger = "change" )el_rule(required = TRUE, message = "Please enter your name") el_rule(type = "email", message = "Not a valid email", trigger = "blur") el_rule(type = "enum", enum = c("a", "b"), message = "a or b") # Element's custom validator el_rule( validator = JS( "function(rule, value, callback) {", " value % 2 === 0 ? callback() : callback(new Error('An even number'));", "}" ), trigger = "change" )
A scroll area with Element's own thin scrollbars.
el_scrollbar( ..., id = NULL, height = NULL, max_height = NULL, native = NULL, wrap_style = NULL, wrap_class = NULL, view_style = NULL, view_class = NULL, noresize = NULL, tag = NULL, always = NULL, min_size = NULL, role = NULL, aria_label = NULL, aria_orientation = NULL, tabindex = NULL, distance = NULL, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_scrollbar( session = shiny::getDefaultReactiveDomain(), id, height = NULL, max_height = NULL, native = NULL, wrap_style = NULL, wrap_class = NULL, view_style = NULL, view_class = NULL, noresize = NULL, always = NULL, min_size = NULL, aria_label = NULL, tabindex = NULL, distance = NULL, tag = NULL, role = NULL, aria_orientation = NULL )el_scrollbar( ..., id = NULL, height = NULL, max_height = NULL, native = NULL, wrap_style = NULL, wrap_class = NULL, view_style = NULL, view_class = NULL, noresize = NULL, tag = NULL, always = NULL, min_size = NULL, role = NULL, aria_label = NULL, aria_orientation = NULL, tabindex = NULL, distance = NULL, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_scrollbar( session = shiny::getDefaultReactiveDomain(), id, height = NULL, max_height = NULL, native = NULL, wrap_style = NULL, wrap_class = NULL, view_style = NULL, view_class = NULL, noresize = NULL, always = NULL, min_size = NULL, aria_label = NULL, tabindex = NULL, distance = NULL, tag = NULL, role = NULL, aria_orientation = NULL )
... |
Its content: any Shiny UI. Components of this package are folded
into this one's Vue instance, as |
id |
Component ID. Auto-generated if |
height |
Height of scrollbar. Element Plus's |
max_height |
Max height of scrollbar. Element Plus's |
native |
Whether to use the native scrollbar style. Element Plus's
|
wrap_style |
Style of wrap container. Element Plus's |
wrap_class |
Class of wrap container. Element Plus's |
view_style |
Style of view. Element Plus's |
view_class |
Class of view. Element Plus's |
noresize |
Do not respond to container size changes, if the container
size does not change, it is better to set it to optimize performance.
Element Plus's |
tag |
Element tag of the view. Element Plus's |
always |
Always show scrollbar. Element Plus's |
min_size |
Minimum size of scrollbar. Element Plus's |
role |
Role of view. Element Plus's |
aria_label |
Aria-label of view. Element Plus's |
aria_orientation |
Aria-orientation of view. Element Plus's
|
tabindex |
Tabindex of wrap container. Element Plus's |
distance |
Trigger end-reached event distance(px). Element Plus's
|
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents. A scoped slot is written
with |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id>_scroll |
events = "scroll" |
list(scrollLeft, scrollTop), at most every 200 ms |
input$<id>_end_reached |
unasked | triggers when the end of a scroll is triggered |
The same list as el_events("el_scrollbar"), which says how an event's arguments travel.
Callable with call_el(): handleScroll(), scrollTo(), setScrollTop(), setScrollLeft(), update().
update_el_scrollbar() changes the component from the server: every argument of
el_scrollbar() that can change once it is drawn, under the same name. One left
NULL stays as it is; NA returns it to Element's default.
update_el_scrollbar() is called for its side effect and returns NULL invisibly.
el_scrollbar(height = "200px", lapply(1:20, function(i) shiny::tags$p(i)))el_scrollbar(height = "200px", lapply(1:20, function(i) shiny::tags$p(i)))
A row of options, one of them selected: a compact radio group.
el_segmented( id = NULL, value = NULL, options = NULL, size = NULL, block = NULL, disabled = NULL, validate_event = NULL, aria_label = NULL, direction = NULL, props = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, on = NULL ) update_el_segmented( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, size = NULL, block = NULL, validate_event = NULL, aria_label = NULL, direction = NULL, props = NULL )el_segmented( id = NULL, value = NULL, options = NULL, size = NULL, block = NULL, disabled = NULL, validate_event = NULL, aria_label = NULL, direction = NULL, props = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, on = NULL ) update_el_segmented( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, size = NULL, block = NULL, validate_event = NULL, aria_label = NULL, direction = NULL, props = NULL )
id |
Component ID. Auto-generated if |
value |
Binding value: Element Plus's |
options |
The options: a named vector |
size |
Size of component. Element Plus's |
block |
Fit width of parent content. Element Plus's |
disabled |
Whether segmented is disabled. Element Plus's |
validate_event |
Whether to trigger form validation. Element Plus's
|
aria_label |
Native |
direction |
Display direction. Element Plus's |
props |
Which field of an option holds what, when the options are
records named otherwise: |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents. A scoped slot is written
with |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the value |
The same list as el_events("el_segmented"), which says how an event's arguments travel.
Server-side update for el_segmented().
Every other argument of el_segmented() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_segmented() is called for its side effect and returns NULL invisibly.
el_segmented( "period", options = c(Day = "d", Week = "w", Month = "m"), value = "w" ) if (interactive()) { # inside a server function observeEvent(input$reset, update_el_segmented(session, "x", value = NULL)) }el_segmented( "period", options = c(Day = "d", Week = "w", Month = "m"), value = "w" ) if (interactive()) { # inside a server function observeEvent(input$reset, update_el_segmented(session, "x", value = NULL)) }
Creates an Element Plus <el-select> component backed by a Vue instance.
Supports single and multiple selection, filtering, and all standard
Element Plus select props.
el_select( id = NULL, choices = NULL, selected = NULL, multiple = FALSE, placeholder = NULL, disabled = FALSE, clearable = FALSE, filterable = FALSE, size = NULL, multiple_limit = 0, collapse_tags = FALSE, value_key = NULL, name = NULL, autocomplete = NULL, automatic_dropdown = NULL, allow_create = NULL, loading = NULL, loading_text = NULL, no_match_text = NULL, no_data_text = NULL, popper_class = NULL, reserve_keyword = NULL, default_first_option = NULL, remote = NULL, filter_method = NULL, remote_method = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, option_template = NULL, slots = NULL, value = NULL, options = NULL, append_to = NULL, aria_label = NULL, clear_icon = NULL, collapse_tags_tooltip = NULL, debounce = NULL, effect = NULL, empty_values = NULL, fallback_placements = NULL, fit_input_width = NULL, max_collapse_tags = NULL, offset = NULL, persistent = NULL, placement = NULL, popper_options = NULL, popper_style = NULL, remote_show_suffix = NULL, show_arrow = NULL, suffix_icon = NULL, suffix_transition = NULL, tabindex = NULL, tag_effect = NULL, tag_type = NULL, teleported = NULL, validate_event = NULL, value_on_clear = NULL, props = NULL, tag_tooltip = NULL, events = NULL, on = NULL, session = NULL ) update_el_select( session = shiny::getDefaultReactiveDomain(), id, selected = NULL, choices = NULL, disabled = NULL, placeholder = NULL, clearable = NULL, filterable = NULL, multiple_limit = NULL, loading = NULL, loading_text = NULL, no_match_text = NULL, no_data_text = NULL, value = NULL, options = NULL, label = NULL, error = NULL, multiple = NULL, size = NULL, collapse_tags = NULL, value_key = NULL, name = NULL, autocomplete = NULL, automatic_dropdown = NULL, allow_create = NULL, popper_class = NULL, reserve_keyword = NULL, remote = NULL, filter_method = NULL, remote_method = NULL, append_to = NULL, aria_label = NULL, clear_icon = NULL, collapse_tags_tooltip = NULL, debounce = NULL, effect = NULL, empty_values = NULL, fallback_placements = NULL, fit_input_width = NULL, max_collapse_tags = NULL, offset = NULL, persistent = NULL, placement = NULL, popper_options = NULL, popper_style = NULL, remote_show_suffix = NULL, show_arrow = NULL, suffix_icon = NULL, suffix_transition = NULL, tabindex = NULL, tag_effect = NULL, tag_type = NULL, teleported = NULL, validate_event = NULL, value_on_clear = NULL, tag_tooltip = NULL )el_select( id = NULL, choices = NULL, selected = NULL, multiple = FALSE, placeholder = NULL, disabled = FALSE, clearable = FALSE, filterable = FALSE, size = NULL, multiple_limit = 0, collapse_tags = FALSE, value_key = NULL, name = NULL, autocomplete = NULL, automatic_dropdown = NULL, allow_create = NULL, loading = NULL, loading_text = NULL, no_match_text = NULL, no_data_text = NULL, popper_class = NULL, reserve_keyword = NULL, default_first_option = NULL, remote = NULL, filter_method = NULL, remote_method = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, option_template = NULL, slots = NULL, value = NULL, options = NULL, append_to = NULL, aria_label = NULL, clear_icon = NULL, collapse_tags_tooltip = NULL, debounce = NULL, effect = NULL, empty_values = NULL, fallback_placements = NULL, fit_input_width = NULL, max_collapse_tags = NULL, offset = NULL, persistent = NULL, placement = NULL, popper_options = NULL, popper_style = NULL, remote_show_suffix = NULL, show_arrow = NULL, suffix_icon = NULL, suffix_transition = NULL, tabindex = NULL, tag_effect = NULL, tag_type = NULL, teleported = NULL, validate_event = NULL, value_on_clear = NULL, props = NULL, tag_tooltip = NULL, events = NULL, on = NULL, session = NULL ) update_el_select( session = shiny::getDefaultReactiveDomain(), id, selected = NULL, choices = NULL, disabled = NULL, placeholder = NULL, clearable = NULL, filterable = NULL, multiple_limit = NULL, loading = NULL, loading_text = NULL, no_match_text = NULL, no_data_text = NULL, value = NULL, options = NULL, label = NULL, error = NULL, multiple = NULL, size = NULL, collapse_tags = NULL, value_key = NULL, name = NULL, autocomplete = NULL, automatic_dropdown = NULL, allow_create = NULL, popper_class = NULL, reserve_keyword = NULL, remote = NULL, filter_method = NULL, remote_method = NULL, append_to = NULL, aria_label = NULL, clear_icon = NULL, collapse_tags_tooltip = NULL, debounce = NULL, effect = NULL, empty_values = NULL, fallback_placements = NULL, fit_input_width = NULL, max_collapse_tags = NULL, offset = NULL, persistent = NULL, placement = NULL, popper_options = NULL, popper_style = NULL, remote_show_suffix = NULL, show_arrow = NULL, suffix_icon = NULL, suffix_transition = NULL, tabindex = NULL, tag_effect = NULL, tag_type = NULL, teleported = NULL, validate_event = NULL, value_on_clear = NULL, tag_tooltip = NULL )
id |
Input ID. Auto-generated UUID if |
choices, options
|
The choices: a named character vector
( |
selected, value
|
Initially selected value(s); a character vector for
multiple selection. |
multiple |
Whether multiple items can be selected. Default |
placeholder |
Placeholder text shown when nothing is selected. |
disabled |
Whether the select is disabled. Default |
clearable |
Whether to show a clear button. Default |
filterable |
Whether typing filters the options. Default |
size |
Size: |
multiple_limit |
Maximum number of items that can be selected when
|
collapse_tags |
Whether to collapse selected tags into a summary when
|
value_key |
Key that identifies an option when values are objects. Default |
name |
Native |
autocomplete |
Native |
automatic_dropdown |
Whether a filterable select opens its menu on focus. |
allow_create |
Whether the user may create options not in the list. Needs |
loading |
Whether to show the loading state while options are being fetched. |
loading_text |
Text shown while loading. Default |
no_match_text |
Text shown when filtering matches nothing. |
no_data_text |
Text shown when there are no options at all. |
popper_class |
Extra class name for the dropdown panel. |
reserve_keyword |
Whether a multiple filterable select keeps the search term after selecting. |
default_first_option |
Whether Enter picks the first matching option. |
remote |
Whether options are fetched from the server as the user
types. Needs |
filter_method |
|
remote_method |
|
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
width |
Component width, as a CSS unit – |
option_template |
Markup drawn inside each option, in place of its
label – Element's "custom template". The option is in reach as |
slots |
Named list of Element slot contents, such as
|
append_to |
Which element the select dropdown appends to. Element
Plus's |
aria_label |
Same as |
clear_icon |
Custom clear icon component. Element Plus's |
collapse_tags_tooltip |
Whether show all selected tags when mouse
hover text of collapse-tags. To use this, |
debounce |
Debounce delay during remote search, in milliseconds.
Element Plus's |
effect |
Tooltip theme, built-in theme: |
empty_values |
Empty values of component, see config-provider. Element
Plus's |
fallback_placements |
List of possible positions for dropdown
popper.js. Element Plus's |
fit_input_width |
Whether the width of the dropdown is the same as the
input. Element Plus's |
max_collapse_tags |
The max tags number to be shown. To use this,
|
offset |
Offset of the dropdown. Element Plus's |
persistent |
When select dropdown is inactive and |
placement |
Position of dropdown. Element Plus's |
popper_options |
Popper.js parameters. Element Plus's |
popper_style |
Custom style for Select's dropdown and tags' tooltip.
Element Plus's |
remote_show_suffix |
In remote search method show suffix icon. Element
Plus's |
show_arrow |
Whether the dropdown has an arrow. Element Plus's
|
suffix_icon |
Custom suffix icon component. Element Plus's
|
suffix_transition |
Animation when dropdown appears/disappears icon.
Element Plus's |
tabindex |
Tabindex for input. Element Plus's |
tag_effect |
Tag effect. Element Plus's |
tag_type |
Tag type. Element Plus's |
teleported |
Whether select dropdown is teleported, if |
validate_event |
Whether to trigger form validation. Element Plus's
|
value_on_clear |
Clear return value, see config-provider. Element
Plus's |
props |
Which field of an option holds what, when the options are
records named otherwise: |
tag_tooltip |
Settings for the tooltip listing collapsed tags, with
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList containing the Vue-managed select component.
Callable with call_el():
blur() – Blur the Input component, and hide the dropdown
focus() – Focus the Input component
| Input | Reported | Value |
input$<id> |
unasked | the value, several with multiple |
input$<id>_query |
unasked | with remote = TRUE, the text typed; answer with update_el_select(choices =) |
input$<id>_visible_change |
events = "visible_change" |
triggers when the dropdown appears/disappears |
input$<id>_remove_tag |
events = "remove_tag" |
triggers when a tag is removed in multiple mode |
input$<id>_clear |
events = "clear" |
triggers when the clear icon is clicked in a clearable Select |
input$<id>_blur |
events = "blur" |
triggers when Input blurs |
input$<id>_focus |
events = "focus" |
triggers when Input focuses |
input$<id>_end_reached |
unasked | triggers when dropdown scroll reaches an end |
input$<id>_popup_scroll |
events = "popup_scroll" |
list(scroll_left, scroll_top), at most every 200 ms
|
The same list as el_events("el_select"), which says how an event's arguments travel.
With remote = TRUE, filterable = TRUE and no remote_method of your
own, the server does the search, as selectizeInput()'s server mode
does: input$<id>_query is the text typed, and update_el_select()
with the matching choices answers it – the select shows Element's
loading text until then, or for 30 seconds at most.
Server-side update for el_select(). Sends a custom message to update
reactive fields on the underlying Vue instance.
Every other argument of el_select() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_select() is called for its side effect and returns NULL invisibly.
# Each option drawn with a second field beside its label el_select( "city", choices = list( list(value = "bj", label = "Beijing", code = "PEK"), list(value = "sh", label = "Shanghai", code = "SHA") ), option_template = htmltools::tagList( htmltools::tags$span(style = "float: left", "{{ opt.label }}"), htmltools::tags$span( style = "float: right; color: #8492a6", "{{ opt.code }}" ) ) ) # Single-select from a named vector el_select( "sel1", choices = c(Apple = "apple", Banana = "banana", Cherry = "cherry"), selected = "banana" ) # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_select( "fruit", choices = c(Apple = "apple", Banana = "banana", Cherry = "cherry"), selected = "apple", clearable = TRUE ), verbatimTextOutput("selected") ) server <- function(input, output, session) { output$selected <- renderPrint(input$fruit) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_select(session, "city", selected = "sh") }) }# Each option drawn with a second field beside its label el_select( "city", choices = list( list(value = "bj", label = "Beijing", code = "PEK"), list(value = "sh", label = "Shanghai", code = "SHA") ), option_template = htmltools::tagList( htmltools::tags$span(style = "float: left", "{{ opt.label }}"), htmltools::tags$span( style = "float: right; color: #8492a6", "{{ opt.code }}" ) ) ) # Single-select from a named vector el_select( "sel1", choices = c(Apple = "apple", Banana = "banana", Cherry = "cherry"), selected = "banana" ) # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_select( "fruit", choices = c(Apple = "apple", Banana = "banana", Cherry = "cherry"), selected = "apple", clearable = TRUE ), verbatimTextOutput("selected") ) server <- function(input, output, session) { output$selected <- renderPrint(input$fruit) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_select(session, "city", selected = "sh") }) }
A select drawing only the options in view, for lists of thousands.
el_select_v2( id = NULL, value = NULL, options = NULL, multiple = NULL, disabled = NULL, value_key = NULL, size = NULL, clearable = NULL, clear_icon = NULL, collapse_tags = NULL, multiple_limit = NULL, effect = NULL, autocomplete = NULL, placeholder = NULL, filterable = NULL, allow_create = NULL, filter_method = NULL, loading = NULL, loading_text = NULL, reserve_keyword = NULL, default_first_option = NULL, no_match_text = NULL, no_data_text = NULL, popper_class = NULL, popper_style = NULL, teleported = NULL, append_to = NULL, persistent = NULL, popper_options = NULL, automatic_dropdown = NULL, fit_input_width = NULL, suffix_icon = NULL, height = NULL, item_height = NULL, estimated_option_height = NULL, scrollbar_always_on = NULL, remote = NULL, debounce = NULL, remote_method = NULL, remote_show_suffix = NULL, validate_event = NULL, offset = NULL, show_arrow = NULL, placement = NULL, fallback_placements = NULL, collapse_tags_tooltip = NULL, max_collapse_tags = NULL, tag_type = NULL, tag_effect = NULL, aria_label = NULL, empty_values = NULL, value_on_clear = NULL, popper_append_to_body = NULL, tabindex = NULL, props = NULL, tag_tooltip = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_select_v2( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, multiple = NULL, value_key = NULL, size = NULL, clearable = NULL, clear_icon = NULL, collapse_tags = NULL, multiple_limit = NULL, effect = NULL, autocomplete = NULL, placeholder = NULL, filterable = NULL, allow_create = NULL, filter_method = NULL, loading = NULL, loading_text = NULL, reserve_keyword = NULL, no_match_text = NULL, no_data_text = NULL, popper_class = NULL, popper_style = NULL, teleported = NULL, append_to = NULL, persistent = NULL, popper_options = NULL, automatic_dropdown = NULL, fit_input_width = NULL, suffix_icon = NULL, height = NULL, item_height = NULL, estimated_option_height = NULL, scrollbar_always_on = NULL, remote = NULL, debounce = NULL, remote_method = NULL, remote_show_suffix = NULL, validate_event = NULL, offset = NULL, show_arrow = NULL, placement = NULL, fallback_placements = NULL, collapse_tags_tooltip = NULL, max_collapse_tags = NULL, tag_type = NULL, tag_effect = NULL, aria_label = NULL, empty_values = NULL, value_on_clear = NULL, popper_append_to_body = NULL, tabindex = NULL, props = NULL, tag_tooltip = NULL )el_select_v2( id = NULL, value = NULL, options = NULL, multiple = NULL, disabled = NULL, value_key = NULL, size = NULL, clearable = NULL, clear_icon = NULL, collapse_tags = NULL, multiple_limit = NULL, effect = NULL, autocomplete = NULL, placeholder = NULL, filterable = NULL, allow_create = NULL, filter_method = NULL, loading = NULL, loading_text = NULL, reserve_keyword = NULL, default_first_option = NULL, no_match_text = NULL, no_data_text = NULL, popper_class = NULL, popper_style = NULL, teleported = NULL, append_to = NULL, persistent = NULL, popper_options = NULL, automatic_dropdown = NULL, fit_input_width = NULL, suffix_icon = NULL, height = NULL, item_height = NULL, estimated_option_height = NULL, scrollbar_always_on = NULL, remote = NULL, debounce = NULL, remote_method = NULL, remote_show_suffix = NULL, validate_event = NULL, offset = NULL, show_arrow = NULL, placement = NULL, fallback_placements = NULL, collapse_tags_tooltip = NULL, max_collapse_tags = NULL, tag_type = NULL, tag_effect = NULL, aria_label = NULL, empty_values = NULL, value_on_clear = NULL, popper_append_to_body = NULL, tabindex = NULL, props = NULL, tag_tooltip = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_select_v2( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, multiple = NULL, value_key = NULL, size = NULL, clearable = NULL, clear_icon = NULL, collapse_tags = NULL, multiple_limit = NULL, effect = NULL, autocomplete = NULL, placeholder = NULL, filterable = NULL, allow_create = NULL, filter_method = NULL, loading = NULL, loading_text = NULL, reserve_keyword = NULL, no_match_text = NULL, no_data_text = NULL, popper_class = NULL, popper_style = NULL, teleported = NULL, append_to = NULL, persistent = NULL, popper_options = NULL, automatic_dropdown = NULL, fit_input_width = NULL, suffix_icon = NULL, height = NULL, item_height = NULL, estimated_option_height = NULL, scrollbar_always_on = NULL, remote = NULL, debounce = NULL, remote_method = NULL, remote_show_suffix = NULL, validate_event = NULL, offset = NULL, show_arrow = NULL, placement = NULL, fallback_placements = NULL, collapse_tags_tooltip = NULL, max_collapse_tags = NULL, tag_type = NULL, tag_effect = NULL, aria_label = NULL, empty_values = NULL, value_on_clear = NULL, popper_append_to_body = NULL, tabindex = NULL, props = NULL, tag_tooltip = NULL )
id |
Component ID. Auto-generated if |
value |
Binding value: Element Plus's |
options |
The options: a named vector |
multiple |
Is multiple. Element Plus's |
disabled |
Is disabled. Element Plus's |
value_key |
Unique identity key name for value, required when value is
an object. Element Plus's |
size |
Size of component. Element Plus's |
clearable |
Whether select can be cleared. Element Plus's |
clear_icon |
Custom clear icon. Element Plus's |
collapse_tags |
Whether to collapse tags to a text when multiple
selecting. Element Plus's |
multiple_limit |
Maximum number of options user can select when
multiple is true. No limit when set to 0. Element Plus's |
effect |
Tooltip theme, built-in theme: |
autocomplete |
Autocomplete of select input. Element Plus's
|
placeholder |
Placeholder. Element Plus's |
filterable |
Whether Select is filterable. Element Plus's |
allow_create |
Whether creating new items is allowed. To use this,
|
filter_method |
Custom filter method, the first parameter is the
current input value. To use this, |
loading |
Whether Select is loading data from server. Element Plus's
|
loading_text |
Displayed text while loading data from server, default
is 'Loading'. Element Plus's |
reserve_keyword |
Whether reserve the keyword after select filtered
option. Element Plus's |
default_first_option |
Select first matching option on enter key. Use
with |
no_match_text |
Displayed text when no data matches the filtering
query, you can also use slot |
no_data_text |
Displayed text when there is no options, you can also
use slot empty. Element Plus's |
popper_class |
Custom class name for Select's dropdown and tags'
tooltip. Element Plus's |
popper_style |
Custom style for Select's dropdown and tags' tooltip.
Element Plus's |
teleported |
Whether select dropdown is teleported, if |
append_to |
Which element the select dropdown appends to. Element
Plus's |
persistent |
When select dropdown is inactive and |
popper_options |
Popper.js parameters. Element Plus's |
automatic_dropdown |
For non-filterable Select, this prop decides if
the option menu pops up when the input is focused. Element Plus's
|
fit_input_width |
Whether the width of the dropdown is the same as the
input, if the value is |
suffix_icon |
Custom suffix icon component. Element Plus's
|
height |
The height of the dropdown panel, 34px for each item. Element
Plus's |
item_height |
The height of the dropdown item. Element Plus's
|
estimated_option_height |
Controls virtual-list sizing mode: if
undefined, the list uses fixed item height from |
scrollbar_always_on |
Controls whether the scrollbar is always
displayed. Element Plus's |
remote |
Whether search data from server. Element Plus's |
debounce |
Debounce delay during remote search, in milliseconds.
Element Plus's |
remote_method |
Function that gets called when the input value
changes. Its parameter is the current input value. To use this,
|
remote_show_suffix |
In remote search method show suffix icon. Element
Plus's |
validate_event |
Whether to trigger form validation. Element Plus's
|
offset |
Offset of the dropdown. Element Plus's |
show_arrow |
Whether the dropdown has an arrow. Element Plus's
|
placement |
Position of dropdown. Element Plus's |
fallback_placements |
List of possible positions for dropdown
popper.js. Element Plus's |
collapse_tags_tooltip |
Whether show all selected tags when mouse
hover text of collapse-tags. To use this, |
max_collapse_tags |
The max tags number to be shown. To use this,
|
tag_type |
Tag type. Element Plus's |
tag_effect |
Tag effect. Element Plus's |
aria_label |
Same as |
empty_values |
Empty values of component, see config-provider. Element
Plus's |
value_on_clear |
Clear return value, see config-provider. Element
Plus's |
popper_append_to_body |
Whether to append the popper menu to body. If
the positioning of the popper is wrong, you can try to set this prop to
false. Element Plus's |
tabindex |
Tabindex for input. Element Plus's |
props |
Which field of an option holds what, when the options are
records named otherwise: |
tag_tooltip |
Settings for the tooltip listing collapsed tags, with
|
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents: |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the value, several with multiple |
input$<id>_visible_change |
events = "visible_change" |
triggers when the dropdown appears/disappears, the param will be true when it appears, and false otherwise |
input$<id>_remove_tag |
events = "remove_tag" |
triggers when a tag is removed in multiple mode, the param is removed tag value |
input$<id>_clear |
events = "clear" |
triggers when the clear icon is clicked in a clearable Select |
input$<id>_blur |
events = "blur" |
triggers when Input blurs |
input$<id>_focus |
events = "focus" |
triggers when Input focuses |
input$<id>_end_reached |
unasked | triggers when dropdown scroll reaches an end |
The same list as el_events("el_select_v2"), which says how an event's arguments travel.
Callable with call_el(): focus(), blur().
Server-side update for el_select_v2().
Every other argument of el_select_v2() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_select_v2() is called for its side effect and returns NULL invisibly.
el_select_v2("city", options = paste("City", 1:10000), filterable = TRUE) if (interactive()) { # inside a server function observeEvent(input$reset, update_el_select_v2(session, "x", value = NULL)) }el_select_v2("city", options = paste("City", 1:10000), filterable = TRUE) if (interactive()) { # inside a server function observeEvent(input$reset, update_el_select_v2(session, "x", value = NULL)) }
Grey placeholder shapes shown while content is on its way, then the content
itself. In Shiny the usual pattern is to start with loading = TRUE and
switch it off from the server once the work is done.
el_skeleton( id = NULL, ..., loading = TRUE, rows = NULL, animated = NULL, count = NULL, throttle = NULL, width = NULL, class = NULL, style = NULL, slots = NULL, on = NULL, session = NULL ) update_el_skeleton( session = shiny::getDefaultReactiveDomain(), id, loading = NULL, rows = NULL, animated = NULL, count = NULL )el_skeleton( id = NULL, ..., loading = TRUE, rows = NULL, animated = NULL, count = NULL, throttle = NULL, width = NULL, class = NULL, style = NULL, slots = NULL, on = NULL, session = NULL ) update_el_skeleton( session = shiny::getDefaultReactiveDomain(), id, loading = NULL, rows = NULL, animated = NULL, count = NULL )
id |
Component ID. Auto-generated if |
... |
The real content, shown once |
loading |
Whether to show the placeholder. Default |
rows |
Number of placeholder lines. Default |
animated |
Whether the placeholder shimmers. |
count |
How many copies of the placeholder to show. |
throttle |
Delay in milliseconds before the placeholder appears, so a fast load does not flash it. |
width |
Component width, as a CSS unit. |
class, style
|
Extra classes and inline style on the skeleton, as
Element passes them to its root: |
slots |
Named list of Element slot contents. |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
Server-side update for el_skeleton(). loading = FALSE swaps the
placeholder for the real content.
update_el_skeleton() is called for its side effect and returns NULL invisibly.
el_skeleton("report", rows = 4, animated = TRUE, shiny::tableOutput("summary")) if (interactive()) { library(shiny) ui <- el_page(el_skeleton("report", animated = TRUE, tableOutput("summary"))) server <- function(input, output, session) { output$summary <- renderTable({ Sys.sleep(2) on.exit(update_el_skeleton(session, "report", loading = FALSE)) head(mtcars) }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(result(), { update_el_skeleton(session, "report", loading = FALSE) }) }el_skeleton("report", rows = 4, animated = TRUE, shiny::tableOutput("summary")) if (interactive()) { library(shiny) ui <- el_page(el_skeleton("report", animated = TRUE, tableOutput("summary"))) server <- function(input, output, session) { output$summary <- renderTable({ Sys.sleep(2) on.exit(update_el_skeleton(session, "report", loading = FALSE)) head(mtcars) }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(result(), { update_el_skeleton(session, "report", loading = FALSE) }) }
el_skeleton()'s templateElement Plus's el-skeleton-item, for the template slot of
el_skeleton(), which draws a custom placeholder while loading.
el_skeleton_item(variant = NULL, ...)el_skeleton_item(variant = NULL, ...)
variant |
The shape: |
... |
Attributes for the tag, such as |
A tag.
Other items:
el_anchor_link(),
el_breadcrumb_item(),
el_carousel_item(),
el_collapse_item(),
el_descriptions_item(),
el_dropdown_item(),
el_menu_item(),
el_option(),
el_step(),
el_tab_pane(),
el_table_column(),
el_table_v2_column(),
el_timeline_item(),
el_tour_step()
el_skeleton( slots = list( template = htmltools::tagList( el_skeleton_item("image", style = "width: 240px; height: 240px"), el_skeleton_item("p", style = "width: 50%") ) ) )el_skeleton( slots = list( template = htmltools::tagList( el_skeleton_item("image", style = "width: 240px; height: 240px"), el_skeleton_item("p", style = "width: 50%") ) ) )
Creates an Element Plus slider with Vue instance, supporting single value and range modes, marks, vertical orientation, and optional numeric input box.
el_slider( id = NULL, value = 0, min = 0, max = 100, step = 1, range = FALSE, disabled = FALSE, show_input = FALSE, show_stops = FALSE, show_tooltip = TRUE, vertical = FALSE, height = NULL, marks = NULL, label = NULL, input_size = NULL, show_input_controls = NULL, tooltip_class = NULL, format_tooltip = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, aria_label = NULL, format_value_text = NULL, persistent = NULL, placement = NULL, range_end_label = NULL, range_start_label = NULL, size = NULL, validate_event = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_slider( session = shiny::getDefaultReactiveDomain(), id, value = NULL, min = NULL, max = NULL, step = NULL, disabled = NULL, label = NULL, error = NULL, show_input = NULL, show_stops = NULL, show_tooltip = NULL, vertical = NULL, height = NULL, marks = NULL, input_size = NULL, show_input_controls = NULL, tooltip_class = NULL, format_tooltip = NULL, aria_label = NULL, format_value_text = NULL, persistent = NULL, placement = NULL, range_end_label = NULL, range_start_label = NULL, size = NULL, validate_event = NULL )el_slider( id = NULL, value = 0, min = 0, max = 100, step = 1, range = FALSE, disabled = FALSE, show_input = FALSE, show_stops = FALSE, show_tooltip = TRUE, vertical = FALSE, height = NULL, marks = NULL, label = NULL, input_size = NULL, show_input_controls = NULL, tooltip_class = NULL, format_tooltip = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, aria_label = NULL, format_value_text = NULL, persistent = NULL, placement = NULL, range_end_label = NULL, range_start_label = NULL, size = NULL, validate_event = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_slider( session = shiny::getDefaultReactiveDomain(), id, value = NULL, min = NULL, max = NULL, step = NULL, disabled = NULL, label = NULL, error = NULL, show_input = NULL, show_stops = NULL, show_tooltip = NULL, vertical = NULL, height = NULL, marks = NULL, input_size = NULL, show_input_controls = NULL, tooltip_class = NULL, format_tooltip = NULL, aria_label = NULL, format_value_text = NULL, persistent = NULL, placement = NULL, range_end_label = NULL, range_start_label = NULL, size = NULL, validate_event = NULL )
id |
Slider ID. Auto-generated UUID if |
value |
Initial value. A single number, or |
min |
Minimum value. Default |
max |
Maximum value. Default |
step |
Step size. Default |
range |
Whether to enable range selection. Default |
disabled |
Whether the slider is disabled. Default |
show_input |
Whether to display a numeric input box beside the slider
(non-range mode only). Default |
show_stops |
Whether to display stop markers at each step. Default |
show_tooltip |
Whether to display the tooltip when dragging. Default |
vertical |
Whether to display in vertical orientation. Default |
height |
Height of the slider in vertical mode (e.g., |
marks |
Named list of mark labels, e.g.,
|
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
input_size |
Size of the companion input when |
show_input_controls |
Whether the companion input shows its spinner buttons. |
tooltip_class |
Extra class name for the value tooltip. |
format_tooltip |
|
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
aria_label |
Native |
format_value_text |
Format to display the |
persistent |
When slider tooltip inactive and |
placement |
Position of Tooltip. Element Plus's |
range_end_label |
When |
range_start_label |
When |
size |
Size of the slider wrapper, will not work in vertical mode.
Element Plus's |
validate_event |
Whether to trigger form validation. Element Plus's
|
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList with a Vue-managed slider component.
| Input | Reported | Value |
input$<id> |
unasked | the value, two for a range, once the drag ends |
input$<id>_input |
events = "input" |
the value while it is dragged, at most every 200 ms |
The same list as el_events("el_slider"), which says how an event's arguments travel.
Server-side update for el_slider(). Supports updating value, range bounds,
step size, and disabled state.
Every other argument of el_slider() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_slider() is called for its side effect and returns NULL invisibly.
# Basic usage el_slider("slider1", value = 30, min = 0, max = 100) # Range slider el_slider("slider2", value = c(20, 80), range = TRUE) # Vertical slider with marks el_slider( "slider3", value = 50, vertical = TRUE, height = "200px", marks = list("0" = "0km", "50" = "50km", "100" = "100km") ) # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_slider("slider1", value = 50, min = 0, max = 100), verbatimTextOutput("val") ) server <- function(input, output, session) { output$val <- renderPrint(input$slider1) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_slider(session, "score", value = 80) }) }# Basic usage el_slider("slider1", value = 30, min = 0, max = 100) # Range slider el_slider("slider2", value = c(20, 80), range = TRUE) # Vertical slider with marks el_slider( "slider3", value = 50, vertical = TRUE, height = "200px", marks = list("0" = "0km", "50" = "50km", "100" = "100km") ) # Shiny app example if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_slider("slider1", value = 50, min = 0, max = 100), verbatimTextOutput("val") ) server <- function(input, output, session) { output$val <- renderPrint(input$slider1) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_slider(session, "score", value = 80) }) }
Even spacing between its items, in a row or a column, wrapping if asked.
el_space( ..., id = NULL, alignment = NULL, direction = NULL, spacer = NULL, size = NULL, wrap = NULL, fill = NULL, fill_ratio = NULL, width = NULL, slots = NULL, on = NULL ) update_el_space( session = shiny::getDefaultReactiveDomain(), id, alignment = NULL, direction = NULL, spacer = NULL, size = NULL, wrap = NULL, fill = NULL, fill_ratio = NULL )el_space( ..., id = NULL, alignment = NULL, direction = NULL, spacer = NULL, size = NULL, wrap = NULL, fill = NULL, fill_ratio = NULL, width = NULL, slots = NULL, on = NULL ) update_el_space( session = shiny::getDefaultReactiveDomain(), id, alignment = NULL, direction = NULL, spacer = NULL, size = NULL, wrap = NULL, fill = NULL, fill_ratio = NULL )
... |
Its content: any Shiny UI. Components of this package are folded
into this one's Vue instance, as |
id |
Component ID. Auto-generated if |
alignment |
Controls the alignment of items. Element Plus's
|
direction |
Placement direction. Element Plus's |
spacer |
Spacer. Element Plus's |
size |
Spacing size. Element Plus's |
wrap |
Auto wrapping. Element Plus's |
fill |
Whether to fill the container. Element Plus's |
fill_ratio |
Ratio of fill. Element Plus's |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents. A scoped slot is written
with |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
None: it reports nothing.
update_el_space() changes the component from the server: every argument of
el_space() that can change once it is drawn, under the same name. One left
NULL stays as it is; NA returns it to Element's default.
update_el_space() is called for its side effect and returns NULL invisibly.
el_space( el_button("a", "One"), el_button("b", "Two"), el_button("c", "Three"), size = 20 )el_space( el_button("a", "One"), el_button("b", "Two"), el_button("c", "Three"), size = 20 )
Panels side by side, or one above the other, resized by dragging the bars
between them. Give it el_splitter_panel()s.
el_splitter( ..., id = NULL, layout = NULL, lazy = NULL, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_splitter( session = shiny::getDefaultReactiveDomain(), id, layout = NULL, lazy = NULL )el_splitter( ..., id = NULL, layout = NULL, lazy = NULL, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_splitter( session = shiny::getDefaultReactiveDomain(), id, layout = NULL, lazy = NULL )
... |
Its content: any Shiny UI. Components of this package are folded
into this one's Vue instance, as |
id |
Component ID. Auto-generated if |
layout |
Layout direction of the splitter. Element Plus's |
lazy |
Whether to enable lazy mode. Element Plus's |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents. A scoped slot is written
with |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id>_resize_start |
events = "resize_start" |
Triggered when starting to resize a panel, index is the drag bar index |
input$<id>_resize |
events = "resize" |
the sizes, at most every 200 ms |
input$<id>_resize_end |
unasked | Triggered when panel resizing ends, index is the drag bar index |
input$<id>_collapse |
unasked | Triggered when a panel is collapsed, index is the drag bar index |
The same list as el_events("el_splitter"), which says how an event's arguments travel.
update_el_splitter() changes the component from the server: every argument of
el_splitter() that can change once it is drawn, under the same name. One left
NULL stays as it is; NA returns it to Element's default.
update_el_splitter() is called for its side effect and returns NULL invisibly.
el_splitter(el_splitter_panel("Left", size = "30%"), el_splitter_panel("Right"))el_splitter(el_splitter_panel("Left", size = "30%"), el_splitter_panel("Right"))
One panel of an el_splitter().
el_splitter_panel( ..., id = NULL, size = NULL, min = NULL, max = NULL, resizable = NULL, collapsible = NULL, width = NULL, slots = NULL, on = NULL ) update_el_splitter_panel( session = shiny::getDefaultReactiveDomain(), id, size = NULL, min = NULL, max = NULL, resizable = NULL, collapsible = NULL )el_splitter_panel( ..., id = NULL, size = NULL, min = NULL, max = NULL, resizable = NULL, collapsible = NULL, width = NULL, slots = NULL, on = NULL ) update_el_splitter_panel( session = shiny::getDefaultReactiveDomain(), id, size = NULL, min = NULL, max = NULL, resizable = NULL, collapsible = NULL )
... |
Its content: any Shiny UI. Components of this package are folded
into this one's Vue instance, as |
id |
Component ID. Auto-generated if |
size |
Size of the panel (in pixels or percentage). Element Plus's
|
min |
Minimum size of the panel (in pixels or percentage). Element
Plus's |
max |
Maximum size of the panel (in pixels or percentage). Element
Plus's |
resizable |
Whether the panel can be resized. Element Plus's
|
collapsible |
Whether the panel can be collapsed. Element Plus's
|
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
None: it reports nothing.
update_el_splitter_panel() changes a panel's settings: one inside an
el_splitter() is folded into the splitter's instance and still answers
to its own id. One left NULL stays as it is; NA returns it to
Element's default.
update_el_splitter_panel() is called for its side effect and returns
NULL invisibly.
if (interactive()) { # inside a server function observeEvent(input$lock, { update_el_splitter_panel(session, "side", resizable = !input$lock) }) }if (interactive()) { # inside a server function observeEvent(input$lock, { update_el_splitter_panel(session, "side", resizable = !input$lock) }) }
A headline number with a title, and an optional prefix and suffix.
el_countdown() counts down to a moment instead.
el_statistic( id = NULL, value = 0, title = NULL, prefix = NULL, suffix = NULL, precision = NULL, decimal_separator = NULL, group_separator = NULL, value_style = NULL, formatter = NULL, width = NULL, slots = NULL, session = NULL ) el_countdown( id = NULL, value = 0, title = NULL, prefix = NULL, suffix = NULL, format = NULL, value_style = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_statistic( session = shiny::getDefaultReactiveDomain(), id, value = NULL, title = NULL, prefix = NULL, suffix = NULL, precision = NULL, decimal_separator = NULL, group_separator = NULL, value_style = NULL, formatter = NULL ) update_el_countdown( session = shiny::getDefaultReactiveDomain(), id, value = NULL, title = NULL, prefix = NULL, suffix = NULL, format = NULL, value_style = NULL )el_statistic( id = NULL, value = 0, title = NULL, prefix = NULL, suffix = NULL, precision = NULL, decimal_separator = NULL, group_separator = NULL, value_style = NULL, formatter = NULL, width = NULL, slots = NULL, session = NULL ) el_countdown( id = NULL, value = 0, title = NULL, prefix = NULL, suffix = NULL, format = NULL, value_style = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_statistic( session = shiny::getDefaultReactiveDomain(), id, value = NULL, title = NULL, prefix = NULL, suffix = NULL, precision = NULL, decimal_separator = NULL, group_separator = NULL, value_style = NULL, formatter = NULL ) update_el_countdown( session = shiny::getDefaultReactiveDomain(), id, value = NULL, title = NULL, prefix = NULL, suffix = NULL, format = NULL, value_style = NULL )
id |
Component ID. Auto-generated if |
value |
The number; for |
title |
Label above it. |
prefix, suffix
|
Text before and after the number, such as a currency symbol or a unit. |
precision |
Decimal places to show. |
decimal_separator |
Decimal point. Default |
group_separator |
Separator between digit groups. Default |
value_style |
CSS for the number, as a string or a named list. |
formatter |
|
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents: |
session |
In |
format |
How a countdown is shown, in day.js's tokens, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
A Shiny UI element.
el_statistic() reports nothing. el_countdown():
| Input | Reported | Value |
input$<id>_finish |
unasked | countdown end event |
input$<id>_change |
events = "change" |
the milliseconds left, at most once a second |
The same list as el_events("el_countdown"), which says how an event's arguments travel.
Server-side update for el_statistic() and el_countdown().
Every other argument of el_statistic() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_statistic() is called for its side effect and returns NULL invisibly.
update_el_countdown() changes the countdown from the server: every argument
of el_countdown() that can change once it is drawn, under the same name.
One left NULL stays as it is; NA returns it to Element's default.
update_el_countdown() is called for its side effect and returns NULL invisibly.
el_statistic("users", value = 26048, title = "Active users") el_statistic( "revenue", value = 1318.5, title = "Revenue", prefix = "$", precision = 2 ) # A countdown to an hour from now el_countdown( "sale", title = "Sale ends in", value = Sys.time() + 3600, format = "HH:mm:ss" ) if (interactive()) { # inside a server function observe(update_el_statistic(session, "users", value = n_users())) }el_statistic("users", value = 26048, title = "Active users") el_statistic( "revenue", value = 1318.5, title = "Revenue", prefix = "$", precision = 2 ) # A countdown to an hour from now el_countdown( "sale", title = "Sale ends in", value = Sys.time() + 3600, format = "HH:mm:ss" ) if (interactive()) { # inside a server function observe(update_el_statistic(session, "users", value = n_users())) }
el_steps()
Element Plus's el-step, for el_steps(steps =).
el_step(title = NULL, description = NULL, icon = NULL, status = NULL)el_step(title = NULL, description = NULL, icon = NULL, status = NULL)
title |
Step title: text, or markup for the step's title slot. |
description |
Step description: text, or markup. |
icon |
The step's icon, by name, or markup. |
status |
The step's status, set by the steps when not given: |
A step, for el_steps(steps =).
Other items:
el_anchor_link(),
el_breadcrumb_item(),
el_carousel_item(),
el_collapse_item(),
el_descriptions_item(),
el_dropdown_item(),
el_menu_item(),
el_option(),
el_skeleton_item(),
el_tab_pane(),
el_table_column(),
el_table_v2_column(),
el_timeline_item(),
el_tour_step()
el_steps( "s", steps = list( el_step("Step 1", "Some description"), el_step("Step 2", icon = "Upload"), el_step("Step 3", status = "error") ), active = 1 )el_steps( "s", steps = list( el_step("Step 1", "Some description"), el_step("Step 2", icon = "Upload"), el_step("Step 3", status = "error") ), active = 1 )
Element Plus Steps Component
el_steps( id = NULL, steps = list(), active = 0, space = NULL, direction = "horizontal", process_status = "process", finish_status = "finish", align_center = FALSE, simple = FALSE, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_steps( session = shiny::getDefaultReactiveDomain(), id, active = NULL, process_status = NULL, finish_status = NULL, space = NULL, direction = NULL, align_center = NULL, simple = NULL )el_steps( id = NULL, steps = list(), active = 0, space = NULL, direction = "horizontal", process_status = "process", finish_status = "finish", align_center = FALSE, simple = FALSE, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_steps( session = shiny::getDefaultReactiveDomain(), id, active = NULL, process_status = NULL, finish_status = NULL, space = NULL, direction = NULL, align_center = NULL, simple = NULL )
id |
Steps ID (auto-generated if NULL) |
steps |
A list of steps, each an |
active |
Current active step index (0-based) |
space |
Step spacing (number or percentage string) |
direction |
Display direction ("horizontal" or "vertical") |
process_status |
Status of current step |
finish_status |
Status of finished steps |
align_center |
Center align title and description |
simple |
Apply simple style |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
| Input | Reported | Value |
input$<id>_change |
events = "change" |
triggers when the active step changes |
The same list as el_events("el_steps"), which says how an event's arguments travel.
update_el_steps() changes the component from the server.
Every other argument of el_steps() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_steps() is called for its side effect and returns NULL invisibly.
# Basic usage el_steps( id = "my_steps", steps = list( list(title = "Step 1"), list(title = "Step 2"), list(title = "Step 3") ) ) # With descriptions and icons el_steps( id = "my_steps", active = 1, finish_status = "success", steps = list( list( title = "Step 1", description = "Complete registration", icon = "el-icon-edit" ), list( title = "Step 2", description = "Upload documents", icon = "el-icon-upload" ), list(title = "Step 3", description = "Finish", icon = "el-icon-picture") ) ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_steps(session, "wizard", active = 2) }) }# Basic usage el_steps( id = "my_steps", steps = list( list(title = "Step 1"), list(title = "Step 2"), list(title = "Step 3") ) ) # With descriptions and icons el_steps( id = "my_steps", active = 1, finish_status = "success", steps = list( list( title = "Step 1", description = "Complete registration", icon = "el-icon-edit" ), list( title = "Step 2", description = "Upload documents", icon = "el-icon-upload" ), list(title = "Step 3", description = "Finish", icon = "el-icon-picture") ) ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_steps(session, "wizard", active = 2) }) }
Creates an Element Plus switch with Vue instance.
el_switch( id = NULL, value = FALSE, disabled = FALSE, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, active_text = NULL, inactive_text = NULL, active_color = NULL, inactive_color = NULL, active_value = TRUE, inactive_value = FALSE, name = NULL, validate_event = NULL, active_action_icon = NULL, active_icon = NULL, aria_label = NULL, before_change = NULL, border_color = NULL, inactive_action_icon = NULL, inactive_icon = NULL, inline_prompt = NULL, loading = NULL, size = NULL, tabindex = NULL, slots = NULL, on = NULL, session = NULL ) update_el_switch( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, active_text = NULL, inactive_text = NULL, active_color = NULL, inactive_color = NULL, label = NULL, error = NULL, active_value = NULL, inactive_value = NULL, name = NULL, validate_event = NULL, active_action_icon = NULL, active_icon = NULL, aria_label = NULL, before_change = NULL, border_color = NULL, inactive_action_icon = NULL, inactive_icon = NULL, inline_prompt = NULL, loading = NULL, size = NULL, tabindex = NULL )el_switch( id = NULL, value = FALSE, disabled = FALSE, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, active_text = NULL, inactive_text = NULL, active_color = NULL, inactive_color = NULL, active_value = TRUE, inactive_value = FALSE, name = NULL, validate_event = NULL, active_action_icon = NULL, active_icon = NULL, aria_label = NULL, before_change = NULL, border_color = NULL, inactive_action_icon = NULL, inactive_icon = NULL, inline_prompt = NULL, loading = NULL, size = NULL, tabindex = NULL, slots = NULL, on = NULL, session = NULL ) update_el_switch( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, active_text = NULL, inactive_text = NULL, active_color = NULL, inactive_color = NULL, label = NULL, error = NULL, active_value = NULL, inactive_value = NULL, name = NULL, validate_event = NULL, active_action_icon = NULL, active_icon = NULL, aria_label = NULL, before_change = NULL, border_color = NULL, inactive_action_icon = NULL, inactive_icon = NULL, inline_prompt = NULL, loading = NULL, size = NULL, tabindex = NULL )
id |
Switch ID. Auto-generated UUID if |
value |
Initial switch state. Default |
disabled |
Whether the switch is disabled. Default |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
width |
Switch width in pixels (integer). |
active_text |
Text displayed when switch is on. |
inactive_text |
Text displayed when switch is off. |
active_color |
Background color when switch is on (e.g. |
inactive_color |
Background color when switch is off: the CSS variable
|
active_value |
Value reported to Shiny when switch is on. Default |
inactive_value |
Value reported to Shiny when switch is off. Default |
name |
Native |
validate_event |
Whether a change triggers form validation. Default |
active_action_icon |
Component of the icon displayed in action when in
|
active_icon |
Component of the icon displayed when in |
aria_label |
Same as |
before_change |
Before-change hook before the switch state changes. If
|
border_color |
Border color of the switch: the CSS variable
|
inactive_action_icon |
Component of the icon displayed in action when
in |
inactive_icon |
Component of the icon displayed when in |
inline_prompt |
Whether icon or text is displayed inside dot, only the
first character will be rendered for text. Element Plus's |
loading |
Whether Switch is in loading state. Element Plus's |
size |
Size of Switch. Element Plus's |
tabindex |
Tabindex for input. Element Plus's |
slots |
Named list of Element slot contents, such as
|
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList with a Vue-managed switch component.
Callable with call_el():
focus() – Focus the Switch component
| Input | Reported | Value |
input$<id> |
unasked | active_value when on, inactive_value when off
|
The same list as el_events("el_switch"), which says how an event's arguments travel.
Server-side update for el_switch(). Pass only the fields to change;
NULL fields are excluded from the update message.
Every other argument of el_switch() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_switch() is called for its side effect and returns NULL invisibly.
el_switch("sw1", value = TRUE) if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_switch("sw1", active_text = "On", inactive_text = "Off"), verbatimTextOutput("state") ) server <- function(input, output, session) { output$state <- renderPrint(input$sw1) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_switch(session, "live", value = TRUE) }) }el_switch("sw1", value = TRUE) if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_switch("sw1", active_text = "On", inactive_text = "Off"), verbatimTextOutput("state") ) server <- function(input, output, session) { output$state <- renderPrint(input$sw1) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_switch(session, "live", value = TRUE) }) }
el_tabs()
Element Plus's el-tab-pane, for el_tabs(tabs =) and
update_el_tabs(): el_tabs("t", tabs = list(el_tab_pane("One", ...), el_tab_pane("Two", ...))).
el_tab_pane( label, ..., name = label, disabled = NULL, closable = NULL, lazy = NULL )el_tab_pane( label, ..., name = label, disabled = NULL, closable = NULL, lazy = NULL )
label |
Title of the tab. |
... |
The tab's content: tags, text, this package's components. |
name |
The tab's value, |
disabled |
Whether the tab is disabled. |
closable |
Whether this tab can be closed, when the tabs' own
|
lazy |
Render the content only when the tab is first selected. Its components do not exist, and report nothing, until then. |
A tab, for el_tabs(tabs =).
Other items:
el_anchor_link(),
el_breadcrumb_item(),
el_carousel_item(),
el_collapse_item(),
el_descriptions_item(),
el_dropdown_item(),
el_menu_item(),
el_option(),
el_skeleton_item(),
el_step(),
el_table_column(),
el_table_v2_column(),
el_timeline_item(),
el_tour_step()
el_tabs( "t", tabs = list( el_tab_pane("User", "User settings"), el_tab_pane("Config", el_switch("dark"), lazy = TRUE) ) )el_tabs( "t", tabs = list( el_tab_pane("User", "User settings"), el_tab_pane("Config", el_switch("dark"), lazy = TRUE) ) )
Rows of data, with sorting, selection, fixed columns, cell templates and row actions that report to the server.
el_table( id = NULL, data = list(), columns = list(), selection = FALSE, rownames = NULL, border = FALSE, stripe = NULL, size = NULL, height = NULL, max_height = NULL, fit = NULL, show_header = NULL, highlight_current_row = NULL, current_row_key = NULL, row_key = NULL, empty_text = NULL, default_expand_all = NULL, expand_row_keys = NULL, default_sort = NULL, tooltip_effect = NULL, show_summary = NULL, sum_text = NULL, select_on_indeterminate = NULL, indent = NULL, lazy = NULL, tree_props = NULL, row_class_name = NULL, row_style = NULL, cell_class_name = NULL, cell_style = NULL, header_row_class_name = NULL, header_row_style = NULL, header_cell_class_name = NULL, header_cell_style = NULL, span_method = NULL, summary_method = NULL, load = NULL, width = NULL, slots = NULL, loading = FALSE, loading_options = NULL, allow_drag_last_column = NULL, append_filter_panel_to = NULL, flexible = NULL, native_scrollbar = NULL, preserve_expanded_content = NULL, row_expandable = NULL, scrollbar_always_on = NULL, scrollbar_tabindex = NULL, show_overflow_tooltip = NULL, table_layout = NULL, tooltip_formatter = NULL, tooltip_options = NULL, session = NULL, events = NULL, on = NULL ) update_el_table( session = shiny::getDefaultReactiveDomain(), id, data = NULL, insert = NULL, replace = NULL, delete = NULL, at = NULL, columns = NULL, border = NULL, selection = NULL, loading = NULL, loading_options = NULL, stripe = NULL, size = NULL, height = NULL, max_height = NULL, fit = NULL, show_header = NULL, highlight_current_row = NULL, current_row_key = NULL, row_key = NULL, empty_text = NULL, expand_row_keys = NULL, tooltip_effect = NULL, show_summary = NULL, sum_text = NULL, select_on_indeterminate = NULL, indent = NULL, lazy = NULL, tree_props = NULL, row_class_name = NULL, row_style = NULL, cell_class_name = NULL, cell_style = NULL, header_row_class_name = NULL, header_row_style = NULL, header_cell_class_name = NULL, header_cell_style = NULL, span_method = NULL, summary_method = NULL, load = NULL, allow_drag_last_column = NULL, append_filter_panel_to = NULL, flexible = NULL, native_scrollbar = NULL, preserve_expanded_content = NULL, row_expandable = NULL, scrollbar_always_on = NULL, scrollbar_tabindex = NULL, show_overflow_tooltip = NULL, table_layout = NULL, tooltip_formatter = NULL, tooltip_options = NULL )el_table( id = NULL, data = list(), columns = list(), selection = FALSE, rownames = NULL, border = FALSE, stripe = NULL, size = NULL, height = NULL, max_height = NULL, fit = NULL, show_header = NULL, highlight_current_row = NULL, current_row_key = NULL, row_key = NULL, empty_text = NULL, default_expand_all = NULL, expand_row_keys = NULL, default_sort = NULL, tooltip_effect = NULL, show_summary = NULL, sum_text = NULL, select_on_indeterminate = NULL, indent = NULL, lazy = NULL, tree_props = NULL, row_class_name = NULL, row_style = NULL, cell_class_name = NULL, cell_style = NULL, header_row_class_name = NULL, header_row_style = NULL, header_cell_class_name = NULL, header_cell_style = NULL, span_method = NULL, summary_method = NULL, load = NULL, width = NULL, slots = NULL, loading = FALSE, loading_options = NULL, allow_drag_last_column = NULL, append_filter_panel_to = NULL, flexible = NULL, native_scrollbar = NULL, preserve_expanded_content = NULL, row_expandable = NULL, scrollbar_always_on = NULL, scrollbar_tabindex = NULL, show_overflow_tooltip = NULL, table_layout = NULL, tooltip_formatter = NULL, tooltip_options = NULL, session = NULL, events = NULL, on = NULL ) update_el_table( session = shiny::getDefaultReactiveDomain(), id, data = NULL, insert = NULL, replace = NULL, delete = NULL, at = NULL, columns = NULL, border = NULL, selection = NULL, loading = NULL, loading_options = NULL, stripe = NULL, size = NULL, height = NULL, max_height = NULL, fit = NULL, show_header = NULL, highlight_current_row = NULL, current_row_key = NULL, row_key = NULL, empty_text = NULL, expand_row_keys = NULL, tooltip_effect = NULL, show_summary = NULL, sum_text = NULL, select_on_indeterminate = NULL, indent = NULL, lazy = NULL, tree_props = NULL, row_class_name = NULL, row_style = NULL, cell_class_name = NULL, cell_style = NULL, header_row_class_name = NULL, header_row_style = NULL, header_cell_class_name = NULL, header_cell_style = NULL, span_method = NULL, summary_method = NULL, load = NULL, allow_drag_last_column = NULL, append_filter_panel_to = NULL, flexible = NULL, native_scrollbar = NULL, preserve_expanded_content = NULL, row_expandable = NULL, scrollbar_always_on = NULL, scrollbar_tabindex = NULL, show_overflow_tooltip = NULL, table_layout = NULL, tooltip_formatter = NULL, tooltip_options = NULL )
id |
The table's id. Leave it out: in an app the output's id is the
table's. A table given an id in the UI still reports its inputs, but
its data is then fixed in the page and |
data |
A data.frame, or a list of rows (each a named list). A
data.frame is converted to rows automatically and its column names are
sanitised ( |
columns |
The columns, each an
|
selection |
Enable row selection |
rownames |
Whether to show a data.frame's row names as the first
column. |
border |
Draw vertical borders between columns and a frame around
the table. Default |
stripe |
Whether rows alternate background colour. |
size |
Size: |
height |
Table height. Fixes the header and scrolls the body. |
max_height |
Maximum table height, beyond which the body scrolls. |
fit |
Whether column widths stretch to fill the table. Default |
show_header |
Whether the header row is shown. Default |
highlight_current_row |
Whether the clicked row stays highlighted;
the row clicked arrives as |
current_row_key |
Key of the row highlighted at start. Needs |
row_key |
Column whose value identifies a row. Needed for tree data and reserved selection. |
empty_text |
Text shown when there are no rows. Default |
default_expand_all |
Whether expandable rows start expanded. |
expand_row_keys |
Keys of the rows that start expanded. Needs |
default_sort |
Initial sort, as |
tooltip_effect |
Theme of overflow tooltips: |
show_summary |
Whether to add a summary row at the bottom. |
sum_text |
Label of the summary row's first cell. Default |
select_on_indeterminate |
What the header checkbox does when only some rows are selected. Default |
indent |
Horizontal indent between tree levels, in pixels. Default |
lazy |
Whether child rows of tree data are loaded on demand –
from the server, unless |
tree_props |
Field names for tree data, as |
row_class_name |
Class name for every row, or a JS function returning one. |
row_style |
Inline style for every row, or a JS function returning one. |
cell_class_name |
Class name for every cell, or a JS function returning one. |
cell_style |
Inline style for every cell, or a JS function returning one. |
header_row_class_name |
Class name for the header row, or a JS function returning one. |
header_row_style |
Inline style for the header row, or a JS function returning one. |
header_cell_class_name |
Class name for header cells, or a JS function returning one. |
header_cell_style |
Inline style for header cells, or a JS function returning one. |
span_method |
|
summary_method |
|
load |
|
width |
Component width, as a CSS unit. Replaces the table's default
|
slots |
Named list of Element slot contents, such as
|
loading |
Whether to cover the table with Element's loading mask, as
its |
loading_options |
How the mask looks, as a list with the names of
|
allow_drag_last_column |
Whether to allow drag the last column.
Element Plus's |
append_filter_panel_to |
Which element the filter panels appends to.
Element Plus's |
flexible |
Ensure main axis minimum-size doesn't follow the content.
Element Plus's |
native_scrollbar |
Whether to use native scrollbars. Element Plus's
|
preserve_expanded_content |
Whether to preserve expanded row content
in DOM when collapsed. Element Plus's |
row_expandable |
Enable expandable rows, works when the table has a
column type="expand". Element Plus's |
scrollbar_always_on |
Always show scrollbar. Element Plus's
|
scrollbar_tabindex |
Body scrollbar's wrap container tabindex. Element
Plus's |
show_overflow_tooltip |
Whether to hide extra content and show them in
a tooltip when hovering on the cell.It will affect all the table columns,
refer to table tooltip-options. Element Plus's |
table_layout |
Sets the algorithm used to lay out table cells, rows,
and columns. Element Plus's |
tooltip_formatter |
Customize tooltip content when using
|
tooltip_options |
The options for the overflow tooltip, see the
following tooltip component. Element Plus's |
session |
In |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
insert |
Rows to insert – a data.frame, or a list of rows – before
row |
replace |
Rows to put in place of rows |
delete |
Numbers of the rows to delete. |
at |
Where |
In a Shiny app a table is an output, as DT's and reactable's are: the
page holds el_table_output(), the server renders el_table() into it
with render_el_table(), and the output's id names the table's inputs.
Without Shiny – R Markdown, Quarto, a pkgdown page – el_table() is
placed as it is, with no id.
el_table() returns the table's specification, drawn when it is placed
(as an htmlwidget is).
An el_table object, drawn as a table wherever UI goes.
| Input | Reported | Value |
input$<id>_selection_rows |
unasked | the selected row numbers |
input$<id>_selection_change |
unasked | the selected rows, data[rows, , drop = FALSE] |
input$<id>_cell_edit |
unasked | an edited cell: list(row, column, value, old) |
input$<id>_load |
unasked | with lazy = TRUE, a row asking for its children; answer with el_load_children() |
input$<id>_select |
events = "select" |
list(rows, row_index): the selected row numbers, and the row ticked or unticked |
input$<id>_select_all |
events = "select_all" |
list(rows), the selected row numbers |
input$<id>_cell_mouse_enter |
events = "cell_mouse_enter" |
list(row_index, row, column, value) |
input$<id>_cell_mouse_leave |
events = "cell_mouse_leave" |
list(row_index, row, column, value) |
input$<id>_cell_click |
events = "cell_click" |
list(row_index, row, column, value) |
input$<id>_cell_dblclick |
events = "cell_dblclick" |
list(row_index, row, column, value) |
input$<id>_cell_contextmenu |
events = "cell_contextmenu" |
list(row_index, row, column, value) |
input$<id>_row_click |
events = "row_click" |
list(row_index, row, column) |
input$<id>_row_contextmenu |
events = "row_contextmenu" |
list(row_index, row, column) |
input$<id>_row_dblclick |
events = "row_dblclick" |
list(row_index, row, column) |
input$<id>_header_click |
events = "header_click" |
list(column, label) |
input$<id>_header_contextmenu |
events = "header_contextmenu" |
list(column, label) |
input$<id>_sort_change |
unasked | list(column, order) |
input$<id>_filter_change |
unasked | the filters, list(<column key> = values) |
input$<id>_current_change |
unasked | list(row_index, row, previous_index) |
input$<id>_header_dragend |
events = "header_dragend" |
list(column, width, previous_width) |
input$<id>_expand_change |
unasked | list(row_index, expanded) |
input$<id>_scroll |
events = "scroll" |
list(scroll_left, scroll_top), at most every 200 ms
|
The same list as el_events("el_table"), which says how an event's arguments travel.
Rendered into el_table_output("tbl"), the inputs are input$tbl_....
input$tbl itself is not used: Element's table has no value of its own
(no v-model), and the name stays free.
An edit is shown at once and applied to the server's copy of the data,
so el_table_data() and input$tbl_selection_change see it; an
observer of input$tbl_cell_edit saves it, or refuses it by putting the
old value back: update_el_table(session, "tbl", replace = row, at = input$tbl_cell_edit$row).
Row numbers count rows of the data the table shows, whatever the user's
sort – the data el_table_data() returns. Rendering the same data again
keeps the user's ticks, sort and open rows; new data clears the
selection, as Element does, unless rows carry a key: row_key and a
selection column with reserve_selection = TRUE keep the ticked rows
that are still there. Rows inserted, replaced or deleted with
update_el_table() leave the other rows' ticks alone.
With tree data, lazy = TRUE and no load of your own, the server loads
a row's children when it is opened: input$<id>_load asks, with key
(the row's row_key field), row and request; answer with
el_load_children(). A row with children to load carries
hasChildren = TRUE.
A button in a cell reports back with rowAction():
list(label = "", cell = el$button(size = "small",
"@click" = "rowAction('edit', scope)", "Edit"))
sets input$<id>_edit to list(row_index =, row =) – the 1-based row
number, to index your own data with, and the row as the table holds it. It
is an event input: clicking the same row twice reports twice.
Callable with call_el():
clearFilter() – Clear filters of the columns whose columnKey are passed in. If no params, clear all filters
clearSelection() – Used in multiple selection Table, clear user selection
clearSort() – Clear sorting, restore data to the original order
doLayout() – Refresh the layout of Table. When the visibility of Table changes, you may need to call this method to get...
setCurrentRow() – Used in single selection Table, set a certain row selected. If called without any parameter, it will clear...
sort() – Sort Table manually. Property prop is used to set sort column, property order is used to set sort order
toggleAllSelection() – Used in multiple selection Table, toggle the selected state of all rows
toggleRowExpansion() – Used in expandable Table or tree Table, toggle if a certain row is expanded. With the second parameter,...
toggleRowSelection() – Used in multiple selection Table, toggle if a certain row is selected. With the second parameter, you can...
Changes a table from the server, as shiny::updateSelectInput() does a
select: every argument of el_table() that can change once the table is
drawn, under the same name. One left NULL stays as it is; NA returns
a prop to Element's default. rownames, slots, width, events and
the default_* arguments, which are read only when the table is
created, are not here. A table in el_table_output() is reached by the
output's id; rendering it again with render_el_table() does the same
for any argument.
Rows. data replaces them all; insert, replace and delete
change a few and send only those, one of them per call. The server's
copy of the data (el_table_data()) is changed as R would change it –
rbind() to insert, data[at, ] <- replace, data[-delete, ] – and
the browser gets the rows as they then stand, so both hold the same
data. Rows not touched keep their ticks and open state; the selection's
row numbers are reported again, renumbered.
Data that comes from reactive expressions is best rendered: the table is patched in place either way, and one render is one source of the data. An update suits a change an observer makes – a row the user added, edited or deleted. A render after an update leaves the update's rows in place unless the render's own data changed.
A column's cell template is part of the table's markup, made
when the table is. New columns given here keep the template of the
column with the same prop (or label) and may drop it, but cannot
bring a template the table was not created with.
update_el_table() is called for its side effect and returns NULL invisibly.
# A data.frame is enough -- columns are inferred el_table(data = head(iris, 3)) # Explicit columns el_table( data = data.frame(name = c("A", "B"), value = c(1, 2)), columns = list( list(prop = "name", label = "Name"), list(prop = "value", label = "Value", width = "100") ) ) # A Shiny app: the table is an output, its inputs named after it if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_input_number("n", value = 5, min = 1), el_table_output("flowers"), verbatimTextOutput("picked") ) server <- function(input, output, session) { output$flowers <- render_el_table( el_table( data = head(iris, input$n), selection = TRUE, events = "row_dblclick" ) ) # the ticked rows, as R subsets them output$picked <- renderPrint(input$flowers_selection_change) observeEvent(input$flowers_row_dblclick, { el_message(message = paste("Row", input$flowers_row_dblclick$row_index)) }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_table(session, "tbl", data = head(mtcars, 10)) }) # any other argument of el_table() update_el_table(session, "tbl", stripe = TRUE, table_layout = "auto") # back to Element's default update_el_table(session, "tbl", stripe = NA) # a few rows, leaving the rest as they are update_el_table(session, "tbl", insert = head(mtcars, 1), at = 1) update_el_table(session, "tbl", replace = mtcars[3, ], at = 3) update_el_table(session, "tbl", delete = c(2, 5)) }# A data.frame is enough -- columns are inferred el_table(data = head(iris, 3)) # Explicit columns el_table( data = data.frame(name = c("A", "B"), value = c(1, 2)), columns = list( list(prop = "name", label = "Name"), list(prop = "value", label = "Value", width = "100") ) ) # A Shiny app: the table is an output, its inputs named after it if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_input_number("n", value = 5, min = 1), el_table_output("flowers"), verbatimTextOutput("picked") ) server <- function(input, output, session) { output$flowers <- render_el_table( el_table( data = head(iris, input$n), selection = TRUE, events = "row_dblclick" ) ) # the ticked rows, as R subsets them output$picked <- renderPrint(input$flowers_selection_change) observeEvent(input$flowers_row_dblclick, { el_message(message = paste("Row", input$flowers_row_dblclick$row_index)) }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_table(session, "tbl", data = head(mtcars, 10)) }) # any other argument of el_table() update_el_table(session, "tbl", stripe = TRUE, table_layout = "auto") # back to Element's default update_el_table(session, "tbl", stripe = NA) # a few rows, leaving the rest as they are update_el_table(session, "tbl", insert = head(mtcars, 1), at = 1) update_el_table(session, "tbl", replace = mtcars[3, ], at = 3) update_el_table(session, "tbl", delete = c(2, 5)) }
el_table()
Element Plus's el-table-column, for el_table(columns =) and
update_el_table(). A column with columns of its own in ... is a group
header, nested as deep as you like.
el_table_column( prop = NULL, label = NULL, ..., cell = NULL, editable = NULL, editor = NULL, header = NULL, header_html = NULL, filter_icon = NULL, type = NULL, index = NULL, column_key = NULL, width = NULL, min_width = NULL, fixed = NULL, render_header = NULL, sortable = NULL, sort_method = NULL, sort_by = NULL, sort_orders = NULL, resizable = NULL, formatter = NULL, show_overflow_tooltip = NULL, align = NULL, header_align = NULL, class_name = NULL, label_class_name = NULL, selectable = NULL, reserve_selection = NULL, filters = NULL, filter_placement = NULL, filter_class_name = NULL, filter_multiple = NULL, filter_method = NULL, filtered_value = NULL, tooltip_formatter = NULL )el_table_column( prop = NULL, label = NULL, ..., cell = NULL, editable = NULL, editor = NULL, header = NULL, header_html = NULL, filter_icon = NULL, type = NULL, index = NULL, column_key = NULL, width = NULL, min_width = NULL, fixed = NULL, render_header = NULL, sortable = NULL, sort_method = NULL, sort_by = NULL, sort_orders = NULL, resizable = NULL, formatter = NULL, show_overflow_tooltip = NULL, align = NULL, header_align = NULL, class_name = NULL, label_class_name = NULL, selectable = NULL, reserve_selection = NULL, filters = NULL, filter_placement = NULL, filter_class_name = NULL, filter_multiple = NULL, filter_method = NULL, filtered_value = NULL, tooltip_formatter = NULL )
prop |
The field of each row the column shows. |
label |
The column's title. |
... |
Columns under this one, each an |
cell |
A template for each cell, drawn once per row: tags or a
string, with |
editable |
Whether the column's cells are edited in place, and
with what: |
editor |
The editor's props, under Element's names in snake_case:
|
header |
A template for the header cell, as |
header_html |
Markup for the header cell, inserted as it is: pass only what you control. |
filter_icon |
The filter's icon, by name. |
type |
|
index |
For |
column_key |
The column's key, which |
width, min_width
|
The column's width; |
fixed |
Fix the column at the |
render_header |
A |
sortable |
Whether the column sorts; |
sort_method |
A |
sort_by |
The field, fields or |
sort_orders |
The orders a click cycles through: |
resizable |
Whether the column can be resized, with |
formatter |
A |
show_overflow_tooltip |
Hide overflowing content behind a tooltip;
|
align, header_align
|
Alignment of the cells and of the header:
|
class_name, label_class_name
|
Class of the cells and of the header. |
selectable |
For |
reserve_selection |
For |
filters |
The filter's choices: |
filter_placement |
Where the filter's dropdown opens. |
filter_class_name |
Class of the filter's dropdown. |
filter_multiple |
Whether several filter choices can be ticked. |
filter_method |
A |
filtered_value |
The filter's ticked values. |
tooltip_formatter |
A |
A column, for el_table(columns =).
Other items:
el_anchor_link(),
el_breadcrumb_item(),
el_carousel_item(),
el_collapse_item(),
el_descriptions_item(),
el_dropdown_item(),
el_menu_item(),
el_option(),
el_skeleton_item(),
el_step(),
el_tab_pane(),
el_table_v2_column(),
el_timeline_item(),
el_tour_step()
el_table( "t", data = data.frame(date = "2016-05-03", name = "Tom", city = "LA"), columns = list( el_table_column("date", "Date", width = 150, sortable = TRUE), el_table_column( label = "Delivery Info", el_table_column("name", "Name"), el_table_column("city", "City") ) ) )el_table( "t", data = data.frame(date = "2016-05-03", name = "Tom", city = "LA"), columns = list( el_table_column("date", "Date", width = 150, sortable = TRUE), el_table_column( label = "Delivery Info", el_table_column("name", "Name"), el_table_column("city", "City") ) ) )
What the browser holds, as R: the data last rendered with
render_el_table() or sent with update_el_table(), with every row
update_el_table() has since inserted, replaced or deleted. A reactive
read: an observer or output reading it runs again when the data changes.
Row numbers in the table's inputs – input$<id>_selection_rows, a row
event's row_index – index it.
el_table_data(session = shiny::getDefaultReactiveDomain(), id)el_table_data(session = shiny::getDefaultReactiveDomain(), id)
session |
The Shiny session, the current one by default. |
id |
The table's id, the output's. |
The data, as given (a data.frame or a list of rows); NULL for
a table the server has not rendered or updated.
render_el_table(), update_el_table().
if (interactive()) { library(shiny) ui <- el_page(el_table_output("cars"), verbatimTextOutput("n")) server <- function(input, output, session) { output$cars <- render_el_table(el_table(data = head(mtcars))) output$n <- renderText(nrow(el_table_data(id = "cars"))) } shinyApp(ui, server) }if (interactive()) { library(shiny) ui <- el_page(el_table_output("cars"), verbatimTextOutput("n")) server <- function(input, output, session) { output$cars <- render_el_table(el_table(data = head(mtcars))) output$n <- renderText(nrow(el_table_data(id = "cars"))) } shinyApp(ui, server) }
The table of a Shiny app, as DT's DTOutput() and renderDT(): the page
holds el_table_output(), the server renders el_table() into it with
its data. Rendering again with new data updates the table in place – the
user's sort, ticks and open rows stay (see render_vue()).
el_table_output(outputId, width = "100%", loading = TRUE) render_el_table(expr, env = parent.frame(), quoted = FALSE)el_table_output(outputId, width = "100%", loading = TRUE) render_el_table(expr, env = parent.frame(), quoted = FALSE)
outputId |
The output's id. |
width |
The table's width, as a CSS unit. |
loading |
Whether Element's loading mask covers the table while
Shiny recalculates it, in place of Shiny fading the output – and of
the spinner |
expr |
An expression returning |
env, quoted
|
As for |
The output id names the table's inputs:
input$<id>_selection_rows – the selected row numbers, integers;
NULL with none.
input$<id>_selection_change – the selected rows, data[rows, , drop = FALSE] of the data shown: its columns, types and row names.
input$<id>_current_change, _sort_change, _filter_change,
_expand_change – reported by every table; any other of Element's
events with el_table(events =): see el_events().
update_el_table() and call_el() reach the table by the output id;
el_table_data() reads the data it shows.
The first render sends the table; a render after it whose columns,
templates and options are unchanged sends only the data that changed, as
JSON – as Shiny's own outputs send values rather than markup. With
shiny::bindCache() the table as rendered is cached, the same for every
session, and each session's page still gets only what changed for it.
el_table_output(), a tag; render_el_table(), a render
function.
if (interactive()) { library(shiny) ui <- el_page(el_table_output("cars"), verbatimTextOutput("picked")) server <- function(input, output, session) { output$cars <- render_el_table( el_table(data = head(mtcars), selection = TRUE) ) output$picked <- renderPrint(input$cars_selection_change) } shinyApp(ui, server) }if (interactive()) { library(shiny) ui <- el_page(el_table_output("cars"), verbatimTextOutput("picked")) server <- function(input, output, session) { output$cars <- render_el_table( el_table(data = head(mtcars), selection = TRUE) ) output$picked <- renderPrint(input$cars_selection_change) } shinyApp(ui, server) }
Element's table methods take the row object itself –
toggleRowSelection(row), setCurrentRow(row),
toggleRowExpansion(row) – and compare it by identity, so a copy sent
from R would match nothing. Likewise the upload's abort(file) and
handleRemove(file), and a virtualized tree's expandNode(node) and
collapseNode(node). These stand for the object instead, and the page
puts the real one in its place before the method runs.
el_table_row(index) el_upload_file(name) el_tree_node(key)el_table_row(index) el_upload_file(name) el_tree_node(key)
index |
A row's number, 1-based, as a table's |
name |
A file's name, as it shows in the upload's list. |
key |
A node's key: the field |
A reference, for call_el()'s args.
if (interactive()) { # inside a server function: select the third row, then make it current call_el(session, "tbl", "toggleRowSelection", list(el_table_row(3), TRUE)) call_el(session, "tbl", "setCurrentRow", list(el_table_row(3))) # stop one file call_el(session, "docs", "abort", list(el_upload_file("big.csv"))) # open a node of a virtualized tree call_el(session, "files", "expandNode", list(el_tree_node("src"))) }if (interactive()) { # inside a server function: select the third row, then make it current call_el(session, "tbl", "toggleRowSelection", list(el_table_row(3), TRUE)) call_el(session, "tbl", "setCurrentRow", list(el_table_row(3))) # stop one file call_el(session, "docs", "abort", list(el_upload_file("big.csv"))) # open a node of a virtualized tree call_el(session, "files", "expandNode", list(el_tree_node("src"))) }
A table drawing only the rows and columns in view, for very large data.
el_table_v2( id = NULL, cache = NULL, estimated_row_height = NULL, header_class = NULL, header_props = NULL, header_cell_props = NULL, header_height = NULL, footer_height = NULL, row_class = NULL, row_key = NULL, row_props = NULL, row_height = NULL, row_event_handlers = NULL, cell_props = NULL, columns = NULL, data = NULL, data_getter = NULL, fixed_data = NULL, expand_column_key = NULL, expanded_row_keys = NULL, default_expanded_row_keys = NULL, fixed = NULL, table_v2_width = NULL, height = NULL, max_height = NULL, indent_size = NULL, h_scrollbar_size = NULL, v_scrollbar_size = NULL, scrollbar_always_on = NULL, sort_by = NULL, sort_state = NULL, width = NULL, slots = NULL, methods = NULL, auto_resize = FALSE, events = NULL, on = NULL ) update_el_table_v2( session = shiny::getDefaultReactiveDomain(), id, data = NULL, columns = NULL, sort_by = NULL, expanded_row_keys = NULL, cache = NULL, estimated_row_height = NULL, header_class = NULL, header_props = NULL, header_cell_props = NULL, header_height = NULL, footer_height = NULL, row_class = NULL, row_key = NULL, row_props = NULL, row_height = NULL, row_event_handlers = NULL, cell_props = NULL, data_getter = NULL, fixed_data = NULL, expand_column_key = NULL, fixed = NULL, table_v2_width = NULL, height = NULL, max_height = NULL, indent_size = NULL, h_scrollbar_size = NULL, v_scrollbar_size = NULL, scrollbar_always_on = NULL, sort_state = NULL )el_table_v2( id = NULL, cache = NULL, estimated_row_height = NULL, header_class = NULL, header_props = NULL, header_cell_props = NULL, header_height = NULL, footer_height = NULL, row_class = NULL, row_key = NULL, row_props = NULL, row_height = NULL, row_event_handlers = NULL, cell_props = NULL, columns = NULL, data = NULL, data_getter = NULL, fixed_data = NULL, expand_column_key = NULL, expanded_row_keys = NULL, default_expanded_row_keys = NULL, fixed = NULL, table_v2_width = NULL, height = NULL, max_height = NULL, indent_size = NULL, h_scrollbar_size = NULL, v_scrollbar_size = NULL, scrollbar_always_on = NULL, sort_by = NULL, sort_state = NULL, width = NULL, slots = NULL, methods = NULL, auto_resize = FALSE, events = NULL, on = NULL ) update_el_table_v2( session = shiny::getDefaultReactiveDomain(), id, data = NULL, columns = NULL, sort_by = NULL, expanded_row_keys = NULL, cache = NULL, estimated_row_height = NULL, header_class = NULL, header_props = NULL, header_cell_props = NULL, header_height = NULL, footer_height = NULL, row_class = NULL, row_key = NULL, row_props = NULL, row_height = NULL, row_event_handlers = NULL, cell_props = NULL, data_getter = NULL, fixed_data = NULL, expand_column_key = NULL, fixed = NULL, table_v2_width = NULL, height = NULL, max_height = NULL, indent_size = NULL, h_scrollbar_size = NULL, v_scrollbar_size = NULL, scrollbar_always_on = NULL, sort_state = NULL )
id |
Component ID. Auto-generated if |
cache |
Number of rows rendered in advance to boost the performance.
Element Plus's |
estimated_row_height |
The estimated row height for rendering dynamic
height rows. Element Plus's |
header_class |
Customized class name passed to header wrapper. Element
Plus's |
header_props |
Customized props name passed to header component.
Element Plus's |
header_cell_props |
Customized props name passed to header cell
component. Element Plus's |
header_height |
The height of the header is set by |
footer_height |
The height of the footer element, when provided, will
be part to the calculation of the table's height. Element Plus's
|
row_class |
Customized class name passed to row wrapper. Element
Plus's |
row_key |
The key of each row, if not provided, will be the index of
the row. Element Plus's |
row_props |
Customized props name passed to row component. Element
Plus's |
row_height |
The height of each row, used for calculating the total
height of the table. Element Plus's |
row_event_handlers |
A collection of handlers attached to each row.
Element Plus's |
cell_props |
Extra props passed to each cell (except header cells).
Element Plus's |
columns |
The columns, each an |
data |
The rows: a data.frame, or a list of rows. Element Plus's
|
data_getter |
A method to customize data fetch from the data source.
Element Plus's |
fixed_data |
Data for rendering rows above the main content and below
the header. Element Plus's |
expand_column_key |
The column key indicates which row is expandable.
Element Plus's |
expanded_row_keys |
An array of keys for expanded rows, can be used
with |
default_expanded_row_keys |
An array of keys for default expanded
rows, NON REACTIVE. Element Plus's |
fixed |
Flag indicates the table column's width to be fixed or
flexible. Element Plus's |
table_v2_width |
Width of the table, in pixels: Element Plus's
|
height |
Height of the table, in pixels. Default |
max_height |
Maximum height of the table. Element Plus's |
indent_size |
Horizontal indentation of tree table. Element Plus's
|
h_scrollbar_size |
Indicates the horizontal scrollbar's size for the
table, used to prevent the horizontal and vertical scrollbar to collapse.
Element Plus's |
v_scrollbar_size |
Indicates the vertical scrollbar's size for the
table, used to prevent the horizontal and vertical scrollbar to collapse.
Element Plus's |
scrollbar_always_on |
If true, the scrollbar will always be shown
instead of when mouse is placed above the table. Element Plus's
|
sort_by |
Sort indicator. Element Plus's |
sort_state |
Multiple sort indicator. Element Plus's |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents: |
methods |
Named list of |
auto_resize |
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id>_column_sort |
unasked | Invoked when column sorted |
input$<id>_expanded_rows_change |
events = "expanded_rows_change" |
Invoked when expanded rows changed |
input$<id>_end_reached |
unasked | Invoked when the end of the table is reached. The callback contain the remain distance, it is the usually the scrollbar height. |
input$<id>_scroll |
events = "scroll" |
at most every 200 ms |
input$<id>_rows_rendered |
events = "rows_rendered" |
at most every 200 ms |
input$<id>_row_expand |
events = "row_expand" |
Invoked when expand/collapse the tree node by clicking the arrow icon |
The same list as el_events("el_table_v2"), which says how an event's arguments travel.
Callable with call_el(): scrollTo(), scrollToLeft(), scrollToTop(), scrollToRow().
Server-side update for el_table_v2(): every argument that can change
once the table is drawn, under the same name. One left NULL stays as it
is; NA returns a prop to Element's default. Rows are given as for
el_table_v2(), a data.frame or a list of rows; a data.frame without
columns keeps the table's columns. methods, slots, width,
auto_resize and default_expanded_row_keys, which Element reads only
when the table is created, are not here.
update_el_table_v2() is called for its side effect and returns NULL invisibly.
el_table_v2( "big", data = data.frame(x = 1:10000, y = rnorm(10000)), width = 600, height = 400 ) if (interactive()) { # inside a server function observeEvent(input$filter_on, { update_el_table_v2(id = "big", data = subset(big, keep)) }) # any other argument of el_table_v2() update_el_table_v2(id = "big", sort_state = list(id = "desc")) }el_table_v2( "big", data = data.frame(x = 1:10000, y = rnorm(10000)), width = 600, height = 400 ) if (interactive()) { # inside a server function observeEvent(input$filter_on, { update_el_table_v2(id = "big", data = subset(big, keep)) }) # any other argument of el_table_v2() update_el_table_v2(id = "big", sort_state = list(id = "desc")) }
el_table_v2()
A column definition for el_table_v2(columns =) and
update_el_table_v2(), under Element Plus's own field names.
el_table_v2_column( key, title = NULL, data_key = key, width = 150, min_width = NULL, max_width = NULL, align = NULL, fixed = NULL, flex_grow = NULL, flex_shrink = NULL, sortable = NULL, hidden = NULL, class = NULL, header_class = NULL, style = NULL, cell_renderer = NULL, header_cell_renderer = NULL )el_table_v2_column( key, title = NULL, data_key = key, width = 150, min_width = NULL, max_width = NULL, align = NULL, fixed = NULL, flex_grow = NULL, flex_shrink = NULL, sortable = NULL, hidden = NULL, class = NULL, header_class = NULL, style = NULL, cell_renderer = NULL, header_cell_renderer = NULL )
key |
The column's unique key. |
title |
The text of its header cell. |
data_key |
The field of each row it shows. Defaults to |
width |
The column's width, in pixels. |
min_width, max_width
|
Its bounds, in pixels. |
align |
Alignment of its cells: |
fixed |
Fix it at the |
flex_grow, flex_shrink
|
Flex grow and shrink, in a table that is not
|
sortable |
Whether it sorts; the sort is reported, the rows are yours to reorder. |
|
Whether it is hidden. |
|
class, header_class
|
Class of its cells and of its header cell. |
style |
Style of its cells, a list of CSS properties. |
cell_renderer, header_cell_renderer
|
|
A column, for el_table_v2(columns =).
Other items:
el_anchor_link(),
el_breadcrumb_item(),
el_carousel_item(),
el_collapse_item(),
el_descriptions_item(),
el_dropdown_item(),
el_menu_item(),
el_option(),
el_skeleton_item(),
el_step(),
el_tab_pane(),
el_table_column(),
el_timeline_item(),
el_tour_step()
el_table_v2( "tv", data = data.frame(id = 1:3, name = c("a", "b", "c")), columns = list( el_table_v2_column("id", "Id", width = 80, fixed = "left"), el_table_v2_column("name", "Name", width = 200, sortable = TRUE) ) )el_table_v2( "tv", data = data.frame(id = 1:3, name = c("a", "b", "c")), columns = list( el_table_v2_column("id", "Id", width = 80, fixed = "left"), el_table_v2_column("name", "Name", width = 200, sortable = TRUE) ) )
A tabbed panel.
el_tabs( id = NULL, tabs = list(), selected = NULL, type = NULL, tab_position = "top", closable = FALSE, addable = FALSE, editable = FALSE, stretch = FALSE, before_leave = NULL, add_icon = NULL, value = NULL, events = NULL, session = NULL ) update_el_tabs( session = shiny::getDefaultReactiveDomain(), id, selected = NULL, type = NULL, tab_position = NULL, closable = NULL, addable = NULL, editable = NULL, stretch = NULL, value = NULL )el_tabs( id = NULL, tabs = list(), selected = NULL, type = NULL, tab_position = "top", closable = FALSE, addable = FALSE, editable = FALSE, stretch = FALSE, before_leave = NULL, add_icon = NULL, value = NULL, events = NULL, session = NULL ) update_el_tabs( session = shiny::getDefaultReactiveDomain(), id, selected = NULL, type = NULL, tab_position = NULL, closable = NULL, addable = NULL, editable = NULL, stretch = NULL, value = NULL )
id |
Tabs ID. Auto-generated UUID if |
tabs |
A list of tabs, each an
|
selected, value
|
Name of the initially selected tab; the first by
default. |
type |
|
tab_position |
|
closable |
Show a close button on each tab. Closing removes the tab
from the page; the server is told through |
addable |
Show a "+" button; clicking it reports
|
editable |
|
stretch |
Stretch the tabs to fill the available width. |
before_leave |
|
add_icon |
The add button's icon, by name. Default |
events |
Element's events to report besides those reported unasked,
by name: |
session |
In |
Rendered as plain markup carrying Element's own classes, driven by a Shiny input binding rather than a Vue instance. That is what lets a tab hold other components from this package: a Vue instance mounted here would rebuild the DOM underneath them, leaving them rendered but disconnected from the server.
An htmltools tag.
| Input | Reported | Value |
input$<id> |
unasked | the name of the selected tab |
input$<id>_tab_click |
events = "tab_click" |
the name of the tab clicked |
input$<id>_tab_change |
events = "tab_change" |
the name of the tab selected |
input$<id>_tab_remove |
unasked | the name of the tab closed |
input$<id>_tab_add |
unasked | triggers when tab-add button is clicked |
input$<id>_edit |
events = "edit" |
list(target, action): the tab's name (NULL for an add) and "add" or "remove"
|
The same list as el_events("el_tabs"), which says how an event's arguments travel.
Server-side update for el_tabs(): the tab selected, and the tabs' look
– type (NA for plain), tab_position, closable, addable,
editable, stretch – as Element's props, all reactive there.
update_el_tabs() is called for its side effect and returns NULL invisibly.
el_tabs( "t1", selected = "a", tabs = list( list(name = "a", label = "First", content = shiny::tags$p("One")), list(name = "b", label = "Second", content = shiny::tags$p("Two")) ) ) # A tab can hold other components el_tabs( "t2", tabs = list( list( name = "data", label = "Data", content = el_table(data = head(iris, 3)) ), list(name = "opts", label = "Options", content = el_switch("live")) ) ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_tabs(session, "section", selected = "data") }) }el_tabs( "t1", selected = "a", tabs = list( list(name = "a", label = "First", content = shiny::tags$p("One")), list(name = "b", label = "Second", content = shiny::tags$p("Two")) ) ) # A tab can hold other components el_tabs( "t2", tabs = list( list( name = "data", label = "Data", content = el_table(data = head(iris, 3)) ), list(name = "opts", label = "Options", content = el_switch("live")) ) ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_tabs(session, "section", selected = "data") }) }
Creates a styled tag/chip component. Tracks click and close events as Shiny inputs.
el_tag( id = NULL, label = "Tag", type = NULL, closable = FALSE, size = NULL, effect = "light", color = NULL, hit = FALSE, disable_transitions = FALSE, round = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_tag( session = shiny::getDefaultReactiveDomain(), id, label = NULL, type = NULL, closable = NULL, size = NULL, effect = NULL, color = NULL, hit = NULL, disable_transitions = NULL, round = NULL )el_tag( id = NULL, label = "Tag", type = NULL, closable = FALSE, size = NULL, effect = "light", color = NULL, hit = FALSE, disable_transitions = FALSE, round = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_tag( session = shiny::getDefaultReactiveDomain(), id, label = NULL, type = NULL, closable = NULL, size = NULL, effect = NULL, color = NULL, hit = NULL, disable_transitions = NULL, round = NULL )
id |
Tag ID. Auto-generated UUID if |
label |
Tag text. |
type |
Tag colour: |
closable |
Whether to show a close button. Default |
size |
Size: |
effect |
Visual effect: |
color |
Custom background colour (CSS string). |
hit |
Whether to show a solid border. Default |
disable_transitions |
Disable the zoom-in-center animation. Default |
round |
Whether Tag is rounded. Element Plus's |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
An htmltools tagList with a Vue-managed tag component.
| Input | Reported | Value |
input$<id> |
unasked | the number of clicks on the tag, as actionButton() reports it |
input$<id>_close |
unasked | fires when the user closes it (closable = TRUE)
|
The same list as el_events("el_tag"), which says how an event's arguments travel.
The clicks are counted as shiny::actionButton() counts them, 0 on load.
Server-side update for el_tag().
Every other argument of el_tag() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_tag() is called for its side effect and returns NULL invisibly.
el_tag("tag1", "Success", type = "success") el_tag("tag2", "Closable", closable = TRUE) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_tag(session, "status", label = "done", type = "success") }) }el_tag("tag1", "Success", type = "success") el_tag("tag2", "Closable", closable = TRUE) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_tag(session, "status", label = "done", type = "success") }) }
Text in Element's colours and sizes, truncated to a line or a number of lines if asked.
el_text( ..., id = NULL, type = NULL, size = NULL, truncated = NULL, line_clamp = NULL, tag = NULL, width = NULL, slots = NULL, on = NULL ) update_el_text( session = shiny::getDefaultReactiveDomain(), id, type = NULL, size = NULL, truncated = NULL, line_clamp = NULL, tag = NULL )el_text( ..., id = NULL, type = NULL, size = NULL, truncated = NULL, line_clamp = NULL, tag = NULL, width = NULL, slots = NULL, on = NULL ) update_el_text( session = shiny::getDefaultReactiveDomain(), id, type = NULL, size = NULL, truncated = NULL, line_clamp = NULL, tag = NULL )
... |
Its content: any Shiny UI. Components of this package are folded
into this one's Vue instance, as |
id |
Component ID. Auto-generated if |
type |
Text type. Element Plus's |
size |
Text size. Element Plus's |
truncated |
Render ellipsis. Element Plus's |
line_clamp |
Maximum lines. Element Plus's |
tag |
Custom element tag. Element Plus's |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents. A scoped slot is written
with |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
None: it reports nothing.
update_el_text() changes the component from the server: every argument of
el_text() that can change once it is drawn, under the same name. One left
NULL stays as it is; NA returns it to Element's default.
update_el_text() is called for its side effect and returns NULL invisibly.
el_text("Primary text", type = "primary") el_text(strrep("A long sentence. ", 20), truncated = TRUE)el_text("Primary text", type = "primary") el_text(strrep("A long sentence. ", 20), truncated = TRUE)
A bslib::bs_theme() carrying Element's own design tokens – its blue,
its success, warning and danger colours, its greys, borders, 4px corners,
14px type and font stack – so that the Bootstrap side of a page, Shiny's
own inputs and outputs among it, matches the Element components next to
it. It is el_page()'s default.
el_theme(..., element = NULL, version = 5)el_theme(..., element = NULL, version = 5)
... |
Overrides, passed on to |
element |
Element Plus's own theme variables, as a named list –
|
version |
Bootstrap major version. Default |
Element styles its components but not the page they sit on, and most of its components set no font of their own: they inherit one. Under a Bootswatch theme they inherit that theme's font instead of Element's, while Element's sizes and colours stay – a mix of the two looks.
The values follow Element Plus's CSS variables:
| Bootstrap | Element Plus | value |
primary |
--el-color-primary |
#409EFF |
success |
--el-color-success |
#67C23A |
warning |
--el-color-warning |
#E6A23C |
danger |
--el-color-danger |
#F56C6C |
info, secondary |
--el-color-info |
#909399 |
fg |
--el-text-color-primary |
#303133 |
border-color |
--el-border-color |
#DCDFE6 |
border-radius |
--el-border-radius-base |
4px |
font-size-base |
--el-font-size-base |
14px
|
primary, success, warning, danger and info reach Element's
components too, with the tints and shades Element derives from each, and
so does anything given to element: el_page() sets Element Plus's CSS
variables for the theme, as its theming guide does – no build involved.
Element puts white text on all five of its colours, some of which fall
short of Bootstrap's default minimum contrast; left alone, Bootstrap would
switch those buttons to black text. min-contrast-ratio is lowered so the
text stays white, as Element has it. Pass "min-contrast-ratio" = 4.5 to
put contrast first.
A bs_theme object, for el_page()'s theme or any page that
takes a bslib theme.
el_theme() # Element's look with another brand colour el_theme(primary = "#7c3aed") # Rounder and smaller, all through Element (compiles Element's Sass) el_theme( element = list("border-radius-base" = "10px", "font-size-base" = "13px") ) if (interactive()) { el_page(theme = el_theme(), shiny::actionButton("go", "Shiny's own button")) }el_theme() # Element's look with another brand colour el_theme(primary = "#7c3aed") # Rounder and smaller, all through Element (compiles Element's Sass) el_theme( element = list("border-radius-base" = "10px", "font-size-base" = "13px") ) if (interactive()) { el_page(theme = el_theme(), shiny::actionButton("go", "Shiny's own button")) }
Pick a time of day. el_time_picker() takes any time, or a range of them
with is_range = TRUE; el_time_select() offers fixed times at a set
interval, such as every half hour between nine and six.
el_time_picker( id = NULL, value = NULL, is_range = FALSE, value_format = "HH:mm:ss", arrow_control = NULL, placeholder = NULL, start_placeholder = NULL, end_placeholder = NULL, range_separator = NULL, clearable = NULL, disabled = NULL, editable = NULL, readonly = NULL, size = NULL, popper_class = NULL, default_value = NULL, prefix_icon = NULL, clear_icon = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, format = NULL, popper_style = NULL, popper_options = NULL, placement = NULL, fallback_placements = NULL, disabled_hours = NULL, disabled_minutes = NULL, disabled_seconds = NULL, teleported = NULL, tabindex = NULL, aria_label = NULL, empty_values = NULL, value_on_clear = NULL, save_on_blur = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) el_time_select( id = NULL, value = NULL, placeholder = NULL, clearable = NULL, disabled = NULL, editable = NULL, size = NULL, popper_class = NULL, prefix_icon = NULL, clear_icon = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, start = NULL, end = NULL, step = NULL, min_time = NULL, max_time = NULL, include_end_time = NULL, format = NULL, effect = NULL, popper_style = NULL, empty_values = NULL, value_on_clear = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_time_picker( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, is_range = NULL, value_format = NULL, arrow_control = NULL, placeholder = NULL, start_placeholder = NULL, end_placeholder = NULL, range_separator = NULL, clearable = NULL, editable = NULL, readonly = NULL, size = NULL, popper_class = NULL, prefix_icon = NULL, clear_icon = NULL, format = NULL, popper_style = NULL, popper_options = NULL, placement = NULL, fallback_placements = NULL, disabled_hours = NULL, disabled_minutes = NULL, disabled_seconds = NULL, teleported = NULL, tabindex = NULL, aria_label = NULL, empty_values = NULL, value_on_clear = NULL, save_on_blur = NULL ) update_el_time_select( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, placeholder = NULL, clearable = NULL, editable = NULL, size = NULL, popper_class = NULL, prefix_icon = NULL, clear_icon = NULL, start = NULL, end = NULL, step = NULL, min_time = NULL, max_time = NULL, include_end_time = NULL, format = NULL, effect = NULL, popper_style = NULL, empty_values = NULL, value_on_clear = NULL )el_time_picker( id = NULL, value = NULL, is_range = FALSE, value_format = "HH:mm:ss", arrow_control = NULL, placeholder = NULL, start_placeholder = NULL, end_placeholder = NULL, range_separator = NULL, clearable = NULL, disabled = NULL, editable = NULL, readonly = NULL, size = NULL, popper_class = NULL, default_value = NULL, prefix_icon = NULL, clear_icon = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, format = NULL, popper_style = NULL, popper_options = NULL, placement = NULL, fallback_placements = NULL, disabled_hours = NULL, disabled_minutes = NULL, disabled_seconds = NULL, teleported = NULL, tabindex = NULL, aria_label = NULL, empty_values = NULL, value_on_clear = NULL, save_on_blur = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) el_time_select( id = NULL, value = NULL, placeholder = NULL, clearable = NULL, disabled = NULL, editable = NULL, size = NULL, popper_class = NULL, prefix_icon = NULL, clear_icon = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, start = NULL, end = NULL, step = NULL, min_time = NULL, max_time = NULL, include_end_time = NULL, format = NULL, effect = NULL, popper_style = NULL, empty_values = NULL, value_on_clear = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_time_picker( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, is_range = NULL, value_format = NULL, arrow_control = NULL, placeholder = NULL, start_placeholder = NULL, end_placeholder = NULL, range_separator = NULL, clearable = NULL, editable = NULL, readonly = NULL, size = NULL, popper_class = NULL, prefix_icon = NULL, clear_icon = NULL, format = NULL, popper_style = NULL, popper_options = NULL, placement = NULL, fallback_placements = NULL, disabled_hours = NULL, disabled_minutes = NULL, disabled_seconds = NULL, teleported = NULL, tabindex = NULL, aria_label = NULL, empty_values = NULL, value_on_clear = NULL, save_on_blur = NULL ) update_el_time_select( session = shiny::getDefaultReactiveDomain(), id, value = NULL, disabled = NULL, label = NULL, error = NULL, placeholder = NULL, clearable = NULL, editable = NULL, size = NULL, popper_class = NULL, prefix_icon = NULL, clear_icon = NULL, start = NULL, end = NULL, step = NULL, min_time = NULL, max_time = NULL, include_end_time = NULL, format = NULL, effect = NULL, popper_style = NULL, empty_values = NULL, value_on_clear = NULL )
id |
Picker ID. Auto-generated if |
value |
Initial time, as |
is_range |
Pick a start and an end rather than a single time. |
value_format |
Format of the value reported to Shiny, in day.js's
tokens. Default |
arrow_control |
Whether hours, minutes and seconds are changed with arrow buttons rather than by scrolling. |
placeholder, start_placeholder, end_placeholder
|
Placeholder text, the latter two for a range. |
range_separator |
Text between the two times of a range. Default |
clearable, disabled, editable, readonly
|
As for an input. |
size |
Size: |
popper_class, popper_style
|
Extra class name and style for the panel. |
default_value |
Time the panel opens on when nothing is picked. |
prefix_icon, clear_icon
|
Icons, by name: |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
format |
Format of the time shown in the input, in day.js's tokens. |
popper_options, placement, fallback_placements
|
Where the panel opens, as Element Plus's tooltip takes them. |
disabled_hours, disabled_minutes, disabled_seconds
|
|
teleported |
Whether the panel is moved to |
tabindex, aria_label
|
Native attributes of the input. |
empty_values, value_on_clear
|
What counts as empty, and the value a cleared picker reports. See Element Plus's config provider. |
save_on_blur |
Whether the time typed is kept when the input loses focus. |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents. |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
include_end_time, start, end, step, min_time, max_time
|
For
|
effect |
|
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the time, two for a range |
input$<id>_blur |
events = "blur" |
triggers when Input blurs |
input$<id>_focus |
events = "focus" |
triggers when Input focuses |
input$<id>_clear |
events = "clear" |
triggers when the clear icon is clicked in a clearable TimePicker |
input$<id>_visible_change |
events = "visible_change" |
triggers when the TimePicker's dropdown appears/disappears |
The same list as el_events("el_time_picker"), which says how an event's arguments travel.
el_time_select():
| Input | Reported | Value |
input$<id> |
unasked | the time |
input$<id>_blur |
events = "blur" |
triggers when Input blurs |
input$<id>_focus |
events = "focus" |
triggers when Input focuses |
input$<id>_clear |
events = "clear" |
triggers when the clear icon is clicked in a clearable TimeSelect |
The same list as el_events("el_time_select"), which says how an event's arguments travel.
Callable with call_el(): focus(), blur(); and for el_time_picker(),
handleOpen() and handleClose().
Server-side update for el_time_picker() and el_time_select();
update_el_time_select() is the time select's, with its own arguments.
Every other argument of el_time_picker() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_time_picker() is called for its side effect and returns NULL invisibly.
update_el_time_select() changes the time select from the server: every
argument of el_time_select() that can change once it is drawn, under the
same name. One left NULL stays as it is; NA returns it to Element's
default.
update_el_time_select() is called for its side effect and returns NULL invisibly.
el_time_picker("start", value = "09:30:00") # Only office hours el_time_picker( "start", disabled_hours = JS( "function() {", " var h = [];", " for (var i = 0; i < 24; i++) if (i < 9 || i > 18) h.push(i);", " return h;", "}" ) ) # A range el_time_picker("shift", is_range = TRUE, value = c("09:00:00", "17:30:00")) # Every half hour between nine and six el_time_select("slot", start = "09:00", step = "00:30", end = "18:00") if (interactive()) { # inside a server function observeEvent( input$reset, update_el_time_picker(session, "start", value = "09:00:00") ) }el_time_picker("start", value = "09:30:00") # Only office hours el_time_picker( "start", disabled_hours = JS( "function() {", " var h = [];", " for (var i = 0; i < 24; i++) if (i < 9 || i > 18) h.push(i);", " return h;", "}" ) ) # A range el_time_picker("shift", is_range = TRUE, value = c("09:00:00", "17:30:00")) # Every half hour between nine and six el_time_select("slot", start = "09:00", step = "00:30", end = "18:00") if (interactive()) { # inside a server function observeEvent( input$reset, update_el_time_picker(session, "start", value = "09:00:00") ) }
A vertical sequence of events.
el_timeline( id = NULL, items = list(), reverse = FALSE, html = FALSE, mode = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_timeline( session = shiny::getDefaultReactiveDomain(), id, items = NULL, reverse = NULL, mode = NULL )el_timeline( id = NULL, items = list(), reverse = FALSE, html = FALSE, mode = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_timeline( session = shiny::getDefaultReactiveDomain(), id, items = NULL, reverse = NULL, mode = NULL )
id |
Timeline ID (auto-generated if NULL). |
items |
A list of entries, each an |
reverse |
Show the entries newest first. |
html |
Render each entry's |
mode |
Relative position of timeline and content. Element Plus's
|
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
Entries are rendered with v-for from a data field, so
update_el_timeline() can replace them – useful for a log that grows.
Content given as tags – el_card(...) – is drawn as markup; a string
is text unless html = TRUE.
A Shiny UI element.
update_el_timeline() changes the component from the server.
Every other argument of el_timeline() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_timeline() is called for its side effect and returns NULL invisibly.
el_timeline( id = "log", items = list( list(content = "Order placed", timestamp = "2026-03-01", type = "primary"), list( content = "Order shipped", timestamp = "2026-03-02", type = "success", icon = "el-icon-check", size = "large" ), list(content = "Delivered", timestamp = "2026-03-04", color = "#0bbd87") ) ) # Newest first, timestamps above each entry el_timeline( id = "log", reverse = TRUE, items = list( list(content = "Second", timestamp = "10:30", placement = "top"), list(content = "First", timestamp = "09:15", placement = "top") ) ) if (interactive()) { # Append an entry to a growing log observeEvent(input$refresh, { log_entries(c( log_entries(), list(list(content = "Refreshed", timestamp = format(Sys.time(), "%H:%M"))) )) update_el_timeline(session, "log", items = log_entries()) }) }el_timeline( id = "log", items = list( list(content = "Order placed", timestamp = "2026-03-01", type = "primary"), list( content = "Order shipped", timestamp = "2026-03-02", type = "success", icon = "el-icon-check", size = "large" ), list(content = "Delivered", timestamp = "2026-03-04", color = "#0bbd87") ) ) # Newest first, timestamps above each entry el_timeline( id = "log", reverse = TRUE, items = list( list(content = "Second", timestamp = "10:30", placement = "top"), list(content = "First", timestamp = "09:15", placement = "top") ) ) if (interactive()) { # Append an entry to a growing log observeEvent(input$refresh, { log_entries(c( log_entries(), list(list(content = "Refreshed", timestamp = format(Sys.time(), "%H:%M"))) )) update_el_timeline(session, "log", items = log_entries()) }) }
el_timeline()
Element Plus's el-timeline-item, for el_timeline(items =).
el_timeline_item( content, timestamp = NULL, hide_timestamp = NULL, center = NULL, placement = NULL, type = NULL, color = NULL, size = NULL, icon = NULL, hollow = NULL )el_timeline_item( content, timestamp = NULL, hide_timestamp = NULL, center = NULL, placement = NULL, type = NULL, color = NULL, size = NULL, icon = NULL, hollow = NULL )
content |
The entry's text (markup with |
timestamp |
Timestamp text. |
hide_timestamp |
Whether to hide the timestamp. By default it is hidden when there is none. |
center |
Whether to centre the node vertically. |
placement |
Where the timestamp goes: |
type |
Node type: |
color |
Background colour of the node. |
size |
Node size: |
icon |
Icon of the node, by name. |
hollow |
Whether the node is hollow. |
An entry, for el_timeline(items =).
Other items:
el_anchor_link(),
el_breadcrumb_item(),
el_carousel_item(),
el_collapse_item(),
el_descriptions_item(),
el_dropdown_item(),
el_menu_item(),
el_option(),
el_skeleton_item(),
el_step(),
el_tab_pane(),
el_table_column(),
el_table_v2_column(),
el_tour_step()
el_timeline( "tl", items = list( el_timeline_item("Event start", timestamp = "2018-04-15"), el_timeline_item("Approved", timestamp = "2018-04-13", type = "success") ) )el_timeline( "tl", items = list( el_timeline_item("Event start", timestamp = "2018-04-15"), el_timeline_item("Approved", timestamp = "2018-04-13", type = "success") ) )
A hint shown when the pointer rests on something.
el_tooltip( id = NULL, reference = NULL, content = NULL, trigger = NULL, placement = NULL, effect = NULL, disabled = NULL, offset = NULL, hide_after = NULL, enterable = NULL, transition = NULL, popper_class = NULL, popper_options = NULL, append_to = NULL, aria_label = NULL, arrow_offset = NULL, auto_close = NULL, fallback_placements = NULL, focus_on_target = NULL, persistent = NULL, popper_style = NULL, raw_content = NULL, show_after = NULL, show_arrow = NULL, teleported = NULL, trigger_keys = NULL, virtual_ref = NULL, virtual_triggering = NULL, visible = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_tooltip( session = shiny::getDefaultReactiveDomain(), id, content = NULL, disabled = NULL, visible = NULL, virtual_ref = NULL )el_tooltip( id = NULL, reference = NULL, content = NULL, trigger = NULL, placement = NULL, effect = NULL, disabled = NULL, offset = NULL, hide_after = NULL, enterable = NULL, transition = NULL, popper_class = NULL, popper_options = NULL, append_to = NULL, aria_label = NULL, arrow_offset = NULL, auto_close = NULL, fallback_placements = NULL, focus_on_target = NULL, persistent = NULL, popper_style = NULL, raw_content = NULL, show_after = NULL, show_arrow = NULL, teleported = NULL, trigger_keys = NULL, virtual_ref = NULL, virtual_triggering = NULL, visible = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_tooltip( session = shiny::getDefaultReactiveDomain(), id, content = NULL, disabled = NULL, visible = NULL, virtual_ref = NULL )
id |
Tooltip ID. Auto-generated if |
reference |
The element the tooltip describes. Any Shiny UI, including
another shiny.element component – that component is folded into the
tooltip's own Vue instance rather than nested inside it, so its inputs
keep reporting. Its |
content |
Text of the hint. |
trigger |
How it opens: |
placement |
Where the hint appears: |
effect |
|
disabled |
Whether the hint is suppressed. |
offset |
Offset from the trigger, in pixels. |
hide_after |
Hide it automatically after this many milliseconds. |
enterable |
Whether the pointer may move onto the hint itself. |
transition |
Name of the transition to animate with. |
popper_class |
Extra class name for the hint. |
popper_options |
Additional Popper.js options, as a named list. |
append_to |
Which element the tooltip CONTENT appends to. Element
Plus's |
aria_label |
Same as |
arrow_offset |
Controls the offset (padding) of the tooltip's arrow
relative to the popper. Element Plus's |
auto_close |
Timeout in milliseconds to hide tooltip, not valid in
controlled mode. Element Plus's |
fallback_placements |
List of possible positions for Tooltip
popper.js. Element Plus's |
focus_on_target |
When triggering tooltips through hover, whether to
focus the trigger element, which improves accessibility. Element Plus's
|
persistent |
When tooltip inactive and |
popper_style |
Custom style for Tooltip's popper. Element Plus's
|
raw_content |
Whether |
show_after |
Delay of appearance, in millisecond, not valid in
controlled mode. Element Plus's |
show_arrow |
Whether the tooltip content has an arrow. Element Plus's
|
teleported |
Whether tooltip content is teleported, if |
trigger_keys |
When you click the mouse to focus on the trigger
element, you can define a set of keyboard codes to control the display of
tooltip through the keyboard, not valid in controlled mode. Element
Plus's |
virtual_ref |
A CSS selector, |
virtual_triggering |
Whether virtual triggering is enabled. Element
Plus's |
visible |
Visibility of Tooltip. Element Plus's |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A component passed as reference becomes part of the tooltip's Vue instance
rather than a separate one, which is what lets it survive being compiled
into the tooltip's markup. It reports its inputs as usual, but it no longer
has a host of its own, so its update_el_*() cannot find it – drive it
through update_vue() on the tooltip's id instead.
A Shiny UI element.
| Input | Reported | Value |
input$<id>_show |
events = "show" |
Triggers when tooltip is shown. Passes trigger reason as argument. |
input$<id>_hide |
events = "hide" |
Triggers when tooltip is hidden. Passes trigger reason as argument. |
input$<id>_before_show |
events = "before_show" |
Triggers before tooltip is shown. Passes trigger reason as argument. |
input$<id>_before_hide |
events = "before_hide" |
Triggers before tooltip is hidden. Passes trigger reason as argument. |
The same list as el_events("el_tooltip"), which says how an event's arguments travel.
Server-side update for el_tooltip(). Setting visible shows or hides
the hint, which then stays as set: Element Plus's tooltip is controlled by
its visible once that is given.
update_el_tooltip() is called for its side effect and returns NULL invisibly.
# A plain tag as the reference el_tooltip( "hint", el$button(type = "primary", "Save"), content = "Writes to disk" ) # Or a component, which keeps working el_tooltip("hint", el_button("save", "Save"), content = "Writes to disk") el_tooltip( "hint", reference = el$button(type = "danger", "Delete"), content = "This cannot be undone", placement = "right", effect = "light" ) if (interactive()) { # inside a server function observeEvent(input$explain, { update_el_tooltip(session, "hint", content = why_disabled()) }) }# A plain tag as the reference el_tooltip( "hint", el$button(type = "primary", "Save"), content = "Writes to disk" ) # Or a component, which keeps working el_tooltip("hint", el_button("save", "Save"), content = "Writes to disk") el_tooltip( "hint", reference = el$button(type = "danger", "Delete"), content = "This cannot be undone", placement = "right", effect = "light" ) if (interactive()) { # inside a server function observeEvent(input$explain, { update_el_tooltip(session, "hint", content = why_disabled()) }) }
A guided tour: a card pointing at one element of the page after another, with the rest of the page dimmed.
el_tour( id = NULL, steps = list(), visible = FALSE, current = NULL, show_arrow = NULL, placement = NULL, content_style = NULL, mask = NULL, gap = NULL, type = NULL, scroll_into_view_options = NULL, z_index = NULL, show_close = NULL, close_icon = NULL, close_on_press_escape = NULL, target_area_clickable = NULL, append_to = NULL, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_tour( session = shiny::getDefaultReactiveDomain(), id, visible = NULL, current = NULL, show_arrow = NULL, placement = NULL, content_style = NULL, mask = NULL, gap = NULL, type = NULL, scroll_into_view_options = NULL, z_index = NULL, show_close = NULL, close_icon = NULL, close_on_press_escape = NULL, target_area_clickable = NULL, append_to = NULL )el_tour( id = NULL, steps = list(), visible = FALSE, current = NULL, show_arrow = NULL, placement = NULL, content_style = NULL, mask = NULL, gap = NULL, type = NULL, scroll_into_view_options = NULL, z_index = NULL, show_close = NULL, close_icon = NULL, close_on_press_escape = NULL, target_area_clickable = NULL, append_to = NULL, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_tour( session = shiny::getDefaultReactiveDomain(), id, visible = NULL, current = NULL, show_arrow = NULL, placement = NULL, content_style = NULL, mask = NULL, gap = NULL, type = NULL, scroll_into_view_options = NULL, z_index = NULL, show_close = NULL, close_icon = NULL, close_on_press_escape = NULL, target_area_clickable = NULL, append_to = NULL )
id |
Tour ID. Auto-generated if |
steps |
The steps, each an |
visible |
Whether it starts open: Element Plus's |
current |
The step it starts on, from 0. |
show_arrow, placement, content_style, mask, gap, type, scroll_into_view_options, z_index, show_close, close_icon, close_on_press_escape, target_area_clickable, append_to
|
Element Plus's tour props of those names: the defaults for every step. |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents: |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | TRUE while it is open |
input$<id>_close |
unasked | the step it was closed on |
input$<id>_change |
unasked | the step, from 0 |
input$<id>_finish |
unasked | callback function on finished |
The same list as el_events("el_tour"), which says how an event's arguments travel.
Open or close an el_tour(), or move it to a step.
Every other argument of el_tour() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_tour() is called for its side effect and returns NULL invisibly.
el_tour( "intro", visible = TRUE, steps = list( list( target = "#upload", title = "Upload", description = "Put your file here." ), list(target = "#run", title = "Run", description = "Then press this.") ) ) if (interactive()) { # inside a server function observeEvent( input$help, update_el_tour(session, "intro", visible = TRUE, current = 0) ) }el_tour( "intro", visible = TRUE, steps = list( list( target = "#upload", title = "Upload", description = "Put your file here." ), list(target = "#run", title = "Run", description = "Then press this.") ) ) if (interactive()) { # inside a server function observeEvent( input$help, update_el_tour(session, "intro", visible = TRUE, current = 0) ) }
el_tour()
Element Plus's el-tour-step, for el_tour(steps =).
el_tour_step( target = NULL, title = NULL, description = NULL, header = NULL, show_arrow = NULL, placement = NULL, content_style = NULL, mask = NULL, type = NULL, next_button_props = NULL, prev_button_props = NULL, scroll_into_view_options = NULL, show_close = NULL, close_icon = NULL )el_tour_step( target = NULL, title = NULL, description = NULL, header = NULL, show_arrow = NULL, placement = NULL, content_style = NULL, mask = NULL, type = NULL, next_button_props = NULL, prev_button_props = NULL, scroll_into_view_options = NULL, show_close = NULL, close_icon = NULL )
target |
The element the step points at, as a CSS selector. |
title, description
|
The step's title and text. |
header |
Markup in place of the title. |
show_arrow |
Whether to show the arrow. |
placement |
Where the card goes, relative to the target: |
content_style |
Style of the content, a list of CSS properties. |
mask |
Whether to mask the page, or the mask's |
type |
|
next_button_props, prev_button_props
|
The Next and Previous buttons'
properties: |
scroll_into_view_options |
Whether to scroll the target into view,
or the options for |
show_close |
Whether to show a close button. |
close_icon |
The close button's icon, by name. |
A step, for el_tour(steps =).
Other items:
el_anchor_link(),
el_breadcrumb_item(),
el_carousel_item(),
el_collapse_item(),
el_descriptions_item(),
el_dropdown_item(),
el_menu_item(),
el_option(),
el_skeleton_item(),
el_step(),
el_tab_pane(),
el_table_column(),
el_table_v2_column(),
el_timeline_item()
el_tour( "tour", steps = list( el_tour_step("#upload", "Upload File", "Put your files here."), el_tour_step(title = "Done", description = "That is all.") ) )el_tour( "tour", steps = list( el_tour_step("#upload", "Upload File", "Put your files here."), el_tour_step(title = "Done", description = "That is all.") ) )
Two lists side by side, for moving items from one to the other.
el_transfer( id = NULL, data = list(), value = NULL, titles = NULL, button_texts = NULL, filterable = NULL, filter_placeholder = NULL, filter_method = NULL, target_order = NULL, format = NULL, props = NULL, left_default_checked = NULL, right_default_checked = NULL, render_content = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, item_size = NULL, validate_event = NULL, virtual_scroll = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_transfer( session = shiny::getDefaultReactiveDomain(), id, value = NULL, data = NULL, titles = NULL, filterable = NULL, label = NULL, error = NULL, button_texts = NULL, filter_placeholder = NULL, filter_method = NULL, target_order = NULL, format = NULL, props = NULL, left_default_checked = NULL, right_default_checked = NULL, render_content = NULL, item_size = NULL, validate_event = NULL, virtual_scroll = NULL )el_transfer( id = NULL, data = list(), value = NULL, titles = NULL, button_texts = NULL, filterable = NULL, filter_placeholder = NULL, filter_method = NULL, target_order = NULL, format = NULL, props = NULL, left_default_checked = NULL, right_default_checked = NULL, render_content = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, item_size = NULL, validate_event = NULL, virtual_scroll = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_transfer( session = shiny::getDefaultReactiveDomain(), id, value = NULL, data = NULL, titles = NULL, filterable = NULL, label = NULL, error = NULL, button_texts = NULL, filter_placeholder = NULL, filter_method = NULL, target_order = NULL, format = NULL, props = NULL, left_default_checked = NULL, right_default_checked = NULL, render_content = NULL, item_size = NULL, validate_event = NULL, virtual_scroll = NULL )
id |
Transfer ID. Auto-generated if |
data |
The items to choose from, as a data.frame with columns |
value |
Keys that start out on the right. |
titles |
Headings of the two panels, as a length-2 character vector.
Default |
button_texts |
Labels of the two buttons, as a length-2 character vector. Default is arrows only. |
filterable |
Whether each panel gets a search box. |
filter_placeholder |
Placeholder of the search boxes. |
filter_method |
|
target_order |
Order of the right-hand panel: |
format |
Counts shown in each heading, as
|
props |
Field names when |
left_default_checked, right_default_checked
|
Keys ticked at the start. |
render_content |
|
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
item_size |
Item height for virtual scrolling. Element Plus's
|
validate_event |
Whether to trigger form validation. Element Plus's
|
virtual_scroll |
Whether to enable virtual scrolling. Element Plus's
|
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the keys on the right |
input$<id>_change |
events = "change" |
list(value, direction, moved) |
input$<id>_left_check_change |
events = "left_check_change" |
list(checked, changed) |
input$<id>_right_check_change |
events = "right_check_change" |
list(checked, changed)
|
The same list as el_events("el_transfer"), which says how an event's arguments travel.
Callable with call_el():
clearQuery() – clear one panel's search box; pass "left" or
"right"
Server-side update for el_transfer().
Every other argument of el_transfer() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_transfer() is called for its side effect and returns NULL invisibly.
el_transfer( "cols", data = data.frame(key = names(iris), label = names(iris)), value = c("Species") ) el_transfer( "cols", data = data.frame(key = names(mtcars), label = names(mtcars)), titles = c("Available", "Chosen"), filterable = TRUE, width = "100%" ) if (interactive()) { # inside a server function observeEvent(input$reset, { update_el_transfer(session, "cols", value = list()) }) }el_transfer( "cols", data = data.frame(key = names(iris), label = names(iris)), value = c("Species") ) el_transfer( "cols", data = data.frame(key = names(mtcars), label = names(mtcars)), titles = c("Available", "Chosen"), filterable = TRUE, width = "100%" ) if (interactive()) { # inside a server function observeEvent(input$reset, { update_el_transfer(session, "cols", value = list()) }) }
A tree view, optionally with checkboxes.
el_tree( id = NULL, data = list(), node_key = "id", props = NULL, show_checkbox = FALSE, check_strictly = FALSE, default_expand_all = FALSE, expand_on_click_node = TRUE, accordion = FALSE, highlight_current = FALSE, default_expanded_keys = NULL, default_checked_keys = NULL, empty_text = NULL, indent = NULL, lazy = NULL, draggable = NULL, auto_expand_parent = NULL, check_on_click_node = NULL, current_node_key = NULL, render_after_expand = NULL, load = NULL, filter_node_method = NULL, render_content = NULL, allow_drag = NULL, allow_drop = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, check_on_click_leaf = NULL, icon = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_tree( session = shiny::getDefaultReactiveDomain(), id, data = NULL, default_expanded_keys = NULL, default_checked_keys = NULL, props = NULL, label = NULL, error = NULL, node_key = NULL, show_checkbox = NULL, check_strictly = NULL, expand_on_click_node = NULL, accordion = NULL, highlight_current = NULL, empty_text = NULL, indent = NULL, lazy = NULL, draggable = NULL, auto_expand_parent = NULL, check_on_click_node = NULL, current_node_key = NULL, render_after_expand = NULL, load = NULL, filter_node_method = NULL, render_content = NULL, allow_drag = NULL, allow_drop = NULL, check_on_click_leaf = NULL, icon = NULL )el_tree( id = NULL, data = list(), node_key = "id", props = NULL, show_checkbox = FALSE, check_strictly = FALSE, default_expand_all = FALSE, expand_on_click_node = TRUE, accordion = FALSE, highlight_current = FALSE, default_expanded_keys = NULL, default_checked_keys = NULL, empty_text = NULL, indent = NULL, lazy = NULL, draggable = NULL, auto_expand_parent = NULL, check_on_click_node = NULL, current_node_key = NULL, render_after_expand = NULL, load = NULL, filter_node_method = NULL, render_content = NULL, allow_drag = NULL, allow_drop = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, check_on_click_leaf = NULL, icon = NULL, width = NULL, slots = NULL, events = NULL, on = NULL, session = NULL ) update_el_tree( session = shiny::getDefaultReactiveDomain(), id, data = NULL, default_expanded_keys = NULL, default_checked_keys = NULL, props = NULL, label = NULL, error = NULL, node_key = NULL, show_checkbox = NULL, check_strictly = NULL, expand_on_click_node = NULL, accordion = NULL, highlight_current = NULL, empty_text = NULL, indent = NULL, lazy = NULL, draggable = NULL, auto_expand_parent = NULL, check_on_click_node = NULL, current_node_key = NULL, render_after_expand = NULL, load = NULL, filter_node_method = NULL, render_content = NULL, allow_drag = NULL, allow_drop = NULL, check_on_click_leaf = NULL, icon = NULL )
id |
Tree ID (auto-generated if NULL). |
data |
A list of nodes. Each is a list with its key ( |
node_key |
Field holding each node's unique key. The keys are what the
server sees and what |
props |
Which field of a node holds what, as Element Plus's |
show_checkbox |
Show a checkbox beside every node. |
check_strictly |
Treat a parent's checkbox as independent of its children, rather than checking them together. |
default_expand_all |
Expand every node initially. |
expand_on_click_node |
Expand a node when its label is clicked, as
well as its arrow. Set |
accordion |
Keep only one node expanded per level. |
highlight_current |
Highlight the clicked node. |
default_expanded_keys, default_checked_keys
|
Keys of the nodes to
expand and to check, as Element Plus's |
empty_text |
Text shown when |
indent |
Horizontal indent between levels, in pixels. Default |
lazy |
Whether child nodes are loaded on demand – from the server,
unless |
draggable |
Whether nodes can be dragged. |
auto_expand_parent |
Whether expanding a node expands its parents. Default |
check_on_click_node |
Whether clicking a node's label also checks it. |
current_node_key |
Key of the node that starts out highlighted. |
render_after_expand |
Whether child nodes are rendered only once expanded. Default |
load |
|
filter_node_method |
|
render_content |
|
allow_drag |
|
allow_drop |
|
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
check_on_click_leaf |
Whether to check or uncheck node when clicking
on leaf node (last children). Element Plus's |
icon |
Custom tree node icon component. Element Plus's |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents, such as
|
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
Unlike the menu, a tree takes its whole structure through a data prop
rather than nested tags, so the nesting is plain R data all the way down.
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the key of the node last clicked |
input$<id>_checked |
unasked | the keys of the checked nodes |
input$<id>_load |
unasked | with lazy = TRUE, a node asking for its children; answer with el_load_children() |
input$<id>_check_change |
events = "check_change" |
list(data, checked, indeterminate) |
input$<id>_current_change |
events = "current_change" |
list(data, key, level) of the current node |
input$<id>_node_expand |
events = "node_expand" |
list(data, key, level) |
input$<id>_node_collapse |
events = "node_collapse" |
list(data, key, level) |
input$<id>_node_contextmenu |
events = "node_contextmenu" |
list(data, key, level) |
input$<id>_node_drag_start |
events = "node_drag_start" |
list(data) of the dragged node |
input$<id>_node_drag_enter |
events = "node_drag_enter" |
list(dragging, drop), the nodes' data |
input$<id>_node_drag_leave |
events = "node_drag_leave" |
list(dragging, drop), the nodes' data |
input$<id>_node_drag_over |
events = "node_drag_over" |
list(dragging, drop), the nodes' data, at most every 200 ms |
input$<id>_node_drag_end |
events = "node_drag_end" |
list(dragging, drop, type) |
input$<id>_node_drop |
events = "node_drop" |
list(dragging, drop, type): type "before", "after" or "inner"
|
The same list as el_events("el_tree"), which says how an event's arguments travel.
input$<id> and input$<id>_checked are reported on load, where they
start empty and therefore arrive as NULL, as Shiny reports any empty
selection.
With lazy = TRUE and no load of your own, the server loads each
node's children: input$<id>_load asks, with level (0 for the top),
key (the node's node_key field), data (the node) and request;
answer with el_load_children().
Callable with call_el():
append() – Append a child node to a given node in the tree
filter() – Filter all tree nodes, filtered nodes will be hidden
getCheckedKeys() – If the node can be selected (show-checkbox is true), it returns the currently selected array of node's keys
getCheckedNodes() – If the node can be selected (show-checkbox is true), it returns the currently selected array of nodes
getCurrentKey() – Return the highlight node's key (null if no node is highlighted)
getCurrentNode() – Return the highlight node's data (null if no node is highlighted)
getHalfCheckedKeys() – If the node can be selected (show-checkbox is true), it returns the currently half selected array of...
getHalfCheckedNodes() – If the node can be selected (show-checkbox is true), it returns the currently half selected array of nodes
getNode() – Get node by data or key
insertAfter() – Insert a node after a given node in the tree
insertBefore() – Insert a node before a given node in the tree
remove() – Remove a node, only works when node-key is assigned
setChecked() – Set node to be checked or not, only works when node-key is assigned
setCheckedKeys() – Set certain nodes to be checked, only works when node-key is assigned
setCheckedNodes() – Set certain nodes to be checked, only works when node-key is assigned
setCurrentKey() – Set highlighted node by key, only works when node-key is assigned
setCurrentNode() – Set highlighted node, only works when node-key is assigned
updateKeyChildren() – Set new data to node, only works when node-key is assigned
update_el_tree() changes the component from the server.
Every other argument of el_tree() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_tree() is called for its side effect and returns NULL invisibly.
nodes <- list( list( id = "fruit", label = "Fruit", children = list( list(id = "apple", label = "Apple"), list(id = "cherry", label = "Cherry") ) ), list( id = "veg", label = "Vegetables", children = list( list(id = "leek", label = "Leek", disabled = TRUE) ) ) ) el_tree(id = "picker", data = nodes) # With checkboxes, two nodes checked and the first branch open el_tree( id = "picker", data = nodes, show_checkbox = TRUE, default_checked_keys = c("apple", "cherry"), default_expanded_keys = "fruit" ) # Nodes whose fields are named otherwise el_tree( data = list(list( id = 1, name = "Docs", kids = list(list(id = 2, name = "R")) )), props = list(label = "name", children = "kids") ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_tree(session, "picker", default_checked_keys = "apple") }) }nodes <- list( list( id = "fruit", label = "Fruit", children = list( list(id = "apple", label = "Apple"), list(id = "cherry", label = "Cherry") ) ), list( id = "veg", label = "Vegetables", children = list( list(id = "leek", label = "Leek", disabled = TRUE) ) ) ) el_tree(id = "picker", data = nodes) # With checkboxes, two nodes checked and the first branch open el_tree( id = "picker", data = nodes, show_checkbox = TRUE, default_checked_keys = c("apple", "cherry"), default_expanded_keys = "fruit" ) # Nodes whose fields are named otherwise el_tree( data = list(list( id = 1, name = "Docs", kids = list(list(id = 2, name = "R")) )), props = list(label = "name", children = "kids") ) if (interactive()) { # inside a server function observeEvent(input$go, { update_el_tree(session, "picker", default_checked_keys = "apple") }) }
A select whose options are a tree: Element Plus's el-tree-select, which
takes the props of both el_select() and el_tree().
el_tree_select( id, data = list(), value = NULL, multiple = NULL, show_checkbox = NULL, check_strictly = NULL, check_on_click_node = NULL, filterable = NULL, clearable = NULL, placeholder = NULL, node_key = NULL, props = NULL, default_expand_all = NULL, render_after_expand = NULL, collapse_tags = NULL, collapse_tags_tooltip = NULL, size = NULL, disabled = NULL, cache_data = NULL, lazy = NULL, load = NULL, ..., label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_tree_select( session = shiny::getDefaultReactiveDomain(), id, value = NULL, data = NULL, disabled = NULL, label = NULL, error = NULL, multiple = NULL, show_checkbox = NULL, check_strictly = NULL, check_on_click_node = NULL, filterable = NULL, clearable = NULL, placeholder = NULL, node_key = NULL, props = NULL, render_after_expand = NULL, collapse_tags = NULL, collapse_tags_tooltip = NULL, size = NULL, cache_data = NULL, lazy = NULL, load = NULL )el_tree_select( id, data = list(), value = NULL, multiple = NULL, show_checkbox = NULL, check_strictly = NULL, check_on_click_node = NULL, filterable = NULL, clearable = NULL, placeholder = NULL, node_key = NULL, props = NULL, default_expand_all = NULL, render_after_expand = NULL, collapse_tags = NULL, collapse_tags_tooltip = NULL, size = NULL, disabled = NULL, cache_data = NULL, lazy = NULL, load = NULL, ..., label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_tree_select( session = shiny::getDefaultReactiveDomain(), id, value = NULL, data = NULL, disabled = NULL, label = NULL, error = NULL, multiple = NULL, show_checkbox = NULL, check_strictly = NULL, check_on_click_node = NULL, filterable = NULL, clearable = NULL, placeholder = NULL, node_key = NULL, props = NULL, render_after_expand = NULL, collapse_tags = NULL, collapse_tags_tooltip = NULL, size = NULL, cache_data = NULL, lazy = NULL, load = NULL )
id |
Component ID; the value is reported as |
data |
The tree: a list of nodes, each |
value |
The selected value, or several with |
multiple |
Whether several nodes can be selected. |
show_checkbox |
Whether nodes have checkboxes. |
check_strictly |
Whether any node can be selected, not only leaves. |
check_on_click_node |
Whether clicking a node checks it, with
|
filterable |
Whether the options can be searched by typing. |
clearable |
Whether the selection can be cleared. |
placeholder |
Placeholder text. |
node_key |
The field that identifies a node. Default |
props |
Where the tree's fields are: |
default_expand_all |
Whether every node starts expanded. |
render_after_expand |
Whether a node's children are drawn only once
it is expanded. Default |
collapse_tags, collapse_tags_tooltip
|
With |
size |
|
disabled |
Whether it can be changed. |
cache_data |
The nodes behind a value not yet loaded, for a lazy tree. |
lazy |
Whether child nodes are loaded on demand – from the server,
which answers |
load |
|
... |
Any other prop of Element Plus's select or tree, in snake_case:
|
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents. |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the value, several with multiple |
input$<id>_load |
unasked | with lazy = TRUE, a node asking for its children; answer with el_load_children() |
input$<id>_visible_change |
events = "visible_change" |
triggers when the dropdown appears/disappears |
input$<id>_clear |
events = "clear" |
triggers when the clear icon is clicked in a clearable Select |
input$<id>_remove_tag |
events = "remove_tag" |
triggers when a tag is removed in multiple mode |
input$<id>_node_click |
events = "node_click" |
triggers when a node is clicked |
input$<id>_check |
events = "check" |
triggers after clicking the checkbox of a node |
The same list as el_events("el_tree_select"), which says how an event's arguments travel.
Callable with call_el(): focus(), blur().
update_el_tree_select() changes the component from the server.
Every other argument of el_tree_select() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_tree_select() is called for its side effect and returns NULL invisibly.
el_tree_select( "dept", placeholder = "Department", data = list( list( value = "eng", label = "Engineering", children = list( list(value = "web", label = "Web"), list(value = "data", label = "Data") ) ), list(value = "ops", label = "Operations") ) ) if (interactive()) { # inside a server function observeEvent( input$reset, update_el_tree_select(session, "dept", value = "ops") ) }el_tree_select( "dept", placeholder = "Department", data = list( list( value = "eng", label = "Engineering", children = list( list(value = "web", label = "Web"), list(value = "data", label = "Data") ) ), list(value = "ops", label = "Operations") ) ) if (interactive()) { # inside a server function observeEvent( input$reset, update_el_tree_select(session, "dept", value = "ops") ) }
A tree drawing only the nodes in view, for tens of thousands of nodes.
el_tree_v2( id = NULL, data = NULL, empty_text = NULL, highlight_current = NULL, expand_on_click_node = NULL, check_on_click_node = NULL, check_on_click_leaf = NULL, default_expanded_keys = NULL, show_checkbox = NULL, check_strictly = NULL, default_checked_keys = NULL, current_node_key = NULL, filter_method = NULL, indent = NULL, icon = NULL, item_size = NULL, scrollbar_always_on = NULL, props = NULL, height = NULL, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_tree_v2( session = shiny::getDefaultReactiveDomain(), id, data = NULL, empty_text = NULL, highlight_current = NULL, expand_on_click_node = NULL, check_on_click_node = NULL, check_on_click_leaf = NULL, show_checkbox = NULL, check_strictly = NULL, indent = NULL, icon = NULL, item_size = NULL, scrollbar_always_on = NULL, props = NULL, height = NULL, current_node_key = NULL, filter_method = NULL )el_tree_v2( id = NULL, data = NULL, empty_text = NULL, highlight_current = NULL, expand_on_click_node = NULL, check_on_click_node = NULL, check_on_click_leaf = NULL, default_expanded_keys = NULL, show_checkbox = NULL, check_strictly = NULL, default_checked_keys = NULL, current_node_key = NULL, filter_method = NULL, indent = NULL, icon = NULL, item_size = NULL, scrollbar_always_on = NULL, props = NULL, height = NULL, width = NULL, slots = NULL, events = NULL, on = NULL ) update_el_tree_v2( session = shiny::getDefaultReactiveDomain(), id, data = NULL, empty_text = NULL, highlight_current = NULL, expand_on_click_node = NULL, check_on_click_node = NULL, check_on_click_leaf = NULL, show_checkbox = NULL, check_strictly = NULL, indent = NULL, icon = NULL, item_size = NULL, scrollbar_always_on = NULL, props = NULL, height = NULL, current_node_key = NULL, filter_method = NULL )
id |
Component ID. Auto-generated if |
data |
Tree data. Element Plus's |
empty_text |
Text displayed when data is void. Element Plus's
|
highlight_current |
Whether current node is highlighted. Element
Plus's |
expand_on_click_node |
Whether to expand or collapse node when
clicking on the node, if false, then expand or collapse node only when
clicking on the arrow icon. Element Plus's |
check_on_click_node |
Whether to check or uncheck node when clicking
on the node, if false, the node can only be checked or unchecked by
clicking on the checkbox. Element Plus's |
check_on_click_leaf |
Whether to check or uncheck node when clicking
on leaf node (last children). Element Plus's |
default_expanded_keys |
Array of keys of initially expanded nodes.
Element Plus's |
show_checkbox |
Whether node is selectable. Element Plus's
|
check_strictly |
Whether checked state of a node not affects its
father and child nodes when |
default_checked_keys |
Array of keys of initially checked nodes.
Element Plus's |
current_node_key |
Key of initially selected node. Element Plus's
|
filter_method |
This function will be executed on each node when use
filter method. if return |
indent |
Horizontal indentation of nodes in adjacent levels in pixels.
Element Plus's |
icon |
Custom tree node icon component. Element Plus's |
item_size |
Custom tree node height. Element Plus's |
scrollbar_always_on |
Always show scrollbar. Element Plus's
|
props |
Which field of a node holds what: |
height |
Height of the tree. Element Plus's |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents: |
events |
Element's events to report besides those reported unasked,
by name: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
| Input | Reported | Value |
input$<id>_node_click |
unasked | triggers when a node is clicked |
input$<id>_node_drop |
events = "node_drop" |
triggers when drag something and drop on a node |
input$<id>_node_contextmenu |
events = "node_contextmenu" |
triggers when a node is clicked by right button |
input$<id>_check_change |
events = "check_change" |
triggers when the selected state of the node changes |
input$<id>_check |
unasked | triggers after clicking the checkbox of a node |
input$<id>_current_change |
events = "current_change" |
triggers when current node changes |
input$<id>_node_expand |
events = "node_expand" |
triggers when current node open |
input$<id>_node_collapse |
events = "node_collapse" |
triggers when current node close |
The same list as el_events("el_tree_v2"), which says how an event's arguments travel.
update_el_tree_v2() changes the component from the server: every argument of
el_tree_v2() that can change once it is drawn, under the same name. One left
NULL stays as it is; NA returns it to Element's default.
update_el_tree_v2() is called for its side effect and returns NULL invisibly.
el_tree_v2( "big", data = lapply(1:1000, function(i) list(id = i, label = paste("Node", i))), height = 300 )el_tree_v2( "big", data = lapply(1:1000, function(i) list(id = i, label = paste("Node", i))), height = 300 )
A file upload area, as a button or a drop zone.
el_upload( id = NULL, button_label = "Upload", drag = FALSE, multiple = FALSE, accept = NULL, limit = NULL, show_file_list = TRUE, list_type = "text", auto_upload = TRUE, disabled = FALSE, name = NULL, tip = NULL, action = NULL, headers = NULL, data = NULL, file_list = NULL, with_credentials = NULL, before_upload = NULL, before_remove = NULL, on_change = NULL, on_progress = NULL, on_preview = NULL, on_remove = NULL, on_exceed = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, crossorigin = NULL, directory = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_upload( session = shiny::getDefaultReactiveDomain(), id, disabled = NULL, limit = NULL, label = NULL, error = NULL, button_label = NULL, drag = NULL, multiple = NULL, accept = NULL, show_file_list = NULL, list_type = NULL, auto_upload = NULL, headers = NULL, data = NULL, file_list = NULL, with_credentials = NULL, before_upload = NULL, before_remove = NULL, on_change = NULL, on_progress = NULL, on_preview = NULL, on_remove = NULL, on_exceed = NULL, crossorigin = NULL, directory = NULL )el_upload( id = NULL, button_label = "Upload", drag = FALSE, multiple = FALSE, accept = NULL, limit = NULL, show_file_list = TRUE, list_type = "text", auto_upload = TRUE, disabled = FALSE, name = NULL, tip = NULL, action = NULL, headers = NULL, data = NULL, file_list = NULL, with_credentials = NULL, before_upload = NULL, before_remove = NULL, on_change = NULL, on_progress = NULL, on_preview = NULL, on_remove = NULL, on_exceed = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, crossorigin = NULL, directory = NULL, width = NULL, slots = NULL, on = NULL, session = NULL ) update_el_upload( session = shiny::getDefaultReactiveDomain(), id, disabled = NULL, limit = NULL, label = NULL, error = NULL, button_label = NULL, drag = NULL, multiple = NULL, accept = NULL, show_file_list = NULL, list_type = NULL, auto_upload = NULL, headers = NULL, data = NULL, file_list = NULL, with_credentials = NULL, before_upload = NULL, before_remove = NULL, on_change = NULL, on_progress = NULL, on_preview = NULL, on_remove = NULL, on_exceed = NULL, crossorigin = NULL, directory = NULL )
id |
Upload ID (auto-generated if NULL). |
button_label |
Text for the trigger, as |
drag |
Render a drop zone rather than a button. |
multiple |
Allow selecting several files at once. |
accept |
File types to accept, as an |
limit |
Maximum number of files. |
show_file_list |
Show the list of chosen files. |
list_type |
|
auto_upload |
Start uploading as soon as files are chosen. |
disabled |
Disable the control. |
name |
Field name Element posts the file under. Only meaningful with
|
tip |
Help text shown under the control. |
action |
Post to this URL using Element's own upload instead of Shiny's channel. See details. |
headers |
Request headers, as a named list. |
data |
Extra fields sent alongside each file, as a named list:
Element Plus's |
file_list |
Files shown initially, each |
with_credentials |
Whether to send cookies with the request. |
before_upload |
|
before_remove |
|
on_change |
|
on_progress |
|
on_preview |
|
on_remove |
|
on_exceed |
|
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
crossorigin |
Native attribute crossorigin. Element Plus's
|
directory |
Whether to support uploading directory. After enabling it,
only folders can be selected, and after selecting a folder, the files
within the folder will be flattened. Element Plus's |
width |
Component width, as a CSS unit – |
slots |
Named list of Element slot contents: |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
In |
By default the files travel through Shiny's own upload channel, so
input$<id> is the same data frame shiny::fileInput() produces, complete
with a datapath pointing at a temporary file. Element's file list,
progress bars and hooks all keep working: only the transport is replaced.
Give action instead to use Element's own upload, posting straight to that
URL. Shiny then plays no part – useful for a pre-signed S3 URL or an
existing file service, but the server sees no datapath.
A Shiny UI element.
| Input | Reported | Value |
input$<id> |
unasked | the files, as fileInput() reports them (without action) |
input$<id>_success |
unasked | with action, the names of the files uploaded |
input$<id>_error |
unasked | the name of a file that failed |
The same list as el_events("el_upload"), which says how an event's arguments travel.
Without action, input$<id> is a data frame of name, size, type
and datapath, one row per file in the last batch, exactly as
shiny::fileInput() reports it. Uploads inherit Shiny's
shiny.maxRequestSize limit and its temporary-file cleanup.
With action, Shiny never sees the files; input$<id>_success lists the
names of files Element uploaded successfully.
Either way, input$<id>_error is the name of a file that failed, as an
event. Without action, the rest of its batch is sent again without it,
so input$<id> holds the files that arrived; a file stopped with
abort() is left out the same way.
Files go up one at a time, as shiny::fileInput() sends them, and each
is marked done once the whole batch has reached the server.
Callable with call_el():
abort() – Cancel upload request: one file, given as its uid, or
every file in flight
clearFiles() – Clear the uploaded file list (this method is not supported in the before-upload hook)
submit() – Upload the file list manually
update_el_upload() changes the component from the server.
Every other argument of el_upload() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_upload() is called for its side effect and returns NULL invisibly.
# A drop zone taking several CSVs, read on the server like fileInput() el_upload( "files", drag = TRUE, multiple = TRUE, accept = ".csv", tip = "CSV files only" ) # A plain button el_upload("avatar", button_label = "Choose a picture", accept = "image/*") # Element's own upload, straight to a pre-signed URL el_upload("direct", action = "https://example.invalid/presigned") if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_upload("files", drag = TRUE, multiple = TRUE), tableOutput("info") ) server <- function(input, output, session) { output$info <- renderTable({ req(input$files) input$files[, c("name", "size", "type")] }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_upload(session, "files", disabled = TRUE) }) }# A drop zone taking several CSVs, read on the server like fileInput() el_upload( "files", drag = TRUE, multiple = TRUE, accept = ".csv", tip = "CSV files only" ) # A plain button el_upload("avatar", button_label = "Choose a picture", accept = "image/*") # Element's own upload, straight to a pre-signed URL el_upload("direct", action = "https://example.invalid/presigned") if (interactive()) { library(shiny) library(shiny.element) ui <- el_page( el_upload("files", drag = TRUE, multiple = TRUE), tableOutput("info") ) server <- function(input, output, session) { output$info <- renderTable({ req(input$files) input$files[, c("name", "size", "type")] }) } shinyApp(ui, server) } if (interactive()) { # inside a server function observeEvent(input$go, { update_el_upload(session, "files", disabled = TRUE) }) }
Empties the list of chosen files, as you would after a form is submitted. It does not undo an upload that has already happened.
el_upload_clear(session = shiny::getDefaultReactiveDomain(), id)el_upload_clear(session = shiny::getDefaultReactiveDomain(), id)
session |
Shiny session; the current one by default, as for
|
id |
Upload ID (un-namespaced). |
Called for its side effect; returns NULL invisibly.
if (interactive()) { # inside a server function observeEvent(input$go, { el_upload_clear(session, "files") }) }if (interactive()) { # inside a server function observeEvent(input$go, { el_upload_clear(session, "files") }) }
Text or an image repeated over its content, faintly.
el_watermark( ..., id = NULL, watermark_width = NULL, height = NULL, rotate = NULL, z_index = NULL, image = NULL, content = NULL, font = NULL, gap = NULL, offset = NULL, width = NULL, slots = NULL, on = NULL ) update_el_watermark( session = shiny::getDefaultReactiveDomain(), id, watermark_width = NULL, height = NULL, rotate = NULL, z_index = NULL, image = NULL, content = NULL, font = NULL, gap = NULL, offset = NULL )el_watermark( ..., id = NULL, watermark_width = NULL, height = NULL, rotate = NULL, z_index = NULL, image = NULL, content = NULL, font = NULL, gap = NULL, offset = NULL, width = NULL, slots = NULL, on = NULL ) update_el_watermark( session = shiny::getDefaultReactiveDomain(), id, watermark_width = NULL, height = NULL, rotate = NULL, z_index = NULL, image = NULL, content = NULL, font = NULL, gap = NULL, offset = NULL )
... |
Its content: any Shiny UI. Components of this package are folded
into this one's Vue instance, as |
id |
Component ID. Auto-generated if |
watermark_width |
The width of the watermark, the default value of
|
height |
The height of the watermark, the default value of |
rotate |
When the watermark is drawn, the rotation angle, in degrees.
Element Plus's |
z_index |
The z-index of the appended watermark element. Element
Plus's |
image |
Image source, it is recommended to export 2x or 3x image, high
priority. Element Plus's |
content |
Watermark text content. Element Plus's |
font |
Text style. Element Plus's |
gap |
The spacing between watermarks. Element Plus's |
offset |
The offset of the watermark from the upper left corner of the
container. The default is |
width |
Component width, as a CSS unit. |
slots |
Named list of Element slot contents. A scoped slot is written
with |
on |
Handlers of your own, for an event not reported or to send
something else: a named list of |
session |
Shiny session; the current one by default, as for
|
A Shiny UI element.
None: it reports nothing.
update_el_watermark() changes the component from the server: every argument of
el_watermark() that can change once it is drawn, under the same name. One left
NULL stays as it is; NA returns it to Element's default.
update_el_watermark() is called for its side effect and returns NULL invisibly.
el_watermark(content = "Confidential", shiny::tags$div(style = "height: 300px"))el_watermark(content = "Confidential", shiny::tags$div(style = "height: 300px"))
Every control in this package has the same shape, and this builds it: a
host element carrying the id, the Element markup inside it, and the Vue
options beside them, which the package's bridge script compiles in place.
The host is a Shiny input binding, so it is the component to the rest of
Shiny – shinyjs::hide("id") hides it, removeUI("#id") removes it and
destroys its Vue instance, and its value is input$<id>.
el_widget( id, markup, data, methods = NULL, watch = NULL, mounted = NULL, computed = NULL, emits = NULL, on = NULL, dependency = NULL, head = NULL, width = NULL, slots = NULL, input = NULL, rate = NULL, type = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, props = NULL, absorbed = NULL )el_widget( id, markup, data, methods = NULL, watch = NULL, mounted = NULL, computed = NULL, emits = NULL, on = NULL, dependency = NULL, head = NULL, width = NULL, slots = NULL, input = NULL, rate = NULL, type = NULL, label = NULL, label_position = c("top", "left", "right"), label_width = NULL, label_suffix = NULL, required = FALSE, error = NULL, show_message = TRUE, inline_message = FALSE, props = NULL, absorbed = NULL )
id |
The element id – inside a module, wrapped in |
markup |
The Element markup to mount on, usually one |
data |
The Vue instance's data. Every field that |
methods, watch, mounted, computed
|
Vue options, included when not |
emits |
Events the component sends with |
on |
Handlers of your own, for events the component does not report
or to send something else than they carry: a named list of |
dependency |
htmlDependency objects to attach, beside Vue, Element Plus and the bridge, which every component carries. |
head |
Tags to place before the host, such as a |
width |
Component width, as a CSS unit. Applied to the Element markup
itself – the host carries |
slots |
Named list of slot contents, one entry per Element slot:
|
input |
The field of |
rate |
How often the value is sent while it changes:
|
type |
An input type for |
label |
A label shown with the component, as Shiny's inputs have:
text or a tag. |
label_position |
Where the label sits, as |
label_width |
Width of a label beside the component, as a CSS unit,
so that several line up. Element's |
label_suffix |
Text after the label, such as |
required |
Draw Element's red asterisk before the label. It marks the
field; it does not check it – shinyvalidate or |
error |
An error message shown under the component in Element's
style, the field framed in red. Element's |
show_message, inline_message
|
Whether |
props |
Optional props from |
absorbed |
The components folded into this one, by id: their fields
as named here and the ref on each, so their updates reach them. Built by
the package's wrappers; leave it |
Reach for it to wrap an Element component this package does not cover, or
to build an input of your own from el tags; input names the value.
It is what the package's own components are made of: vue_app() with
Element Plus installed (use), and a label in Element's form-item style.
The raw Element tags come from el, and template() writes a slot.
A Shiny UI element with its dependencies attached.
# Wrapping el-avatar, which this package does not provide my_avatar <- function(id, src, size = 50) { el_widget( id = id, markup = el$avatar(":src" = "src", ":size" = "size"), data = list(src = src, size = size) ) } my_avatar("face", "https://example.org/face.png") # An input of your own: v-model keeps `value` in step with the control, # and `input` makes it input$score -- on load, on change, and after # update_vue(session, "score", value = 5) from the server. el_widget( id = "score", markup = el$rate("v-model" = "value", ":max" = "max"), data = list(value = 3, max = 5), input = "value" )# Wrapping el-avatar, which this package does not provide my_avatar <- function(id, src, size = 50) { el_widget( id = id, markup = el$avatar(":src" = "src", ":size" = "size"), data = list(src = src, size = size) ) } my_avatar("face", "https://example.org/face.png") # An input of your own: v-model keeps `value` in step with the control, # and `input` makes it input$score -- on load, on change, and after # update_vue(session, "score", value = 5) from the server. el_widget( id = "score", markup = el$rate("v-model" = "value", ":max" = "max"), data = list(value = 3, max = 5), input = "value" )
Element Plus's script and stylesheets – its components, its dark mode
variables and its display classes (hidden-xs-only, ...) – and its icons,
which are components registered on every app by name.
element_plus_dependency(offline = TRUE)element_plus_dependency(offline = TRUE)
offline |
Serve Element Plus from the copy bundled with this package
(the default) instead of the unpkg CDN. The bundled files are
byte-identical to the CDN's. A runtime CDN dependency leaves the page
blank on an intranet, offline, or whenever unpkg is unreachable, so the
local copy is the safer default; pass |
A list of htmlDependency objects.
element_plus_dependency() element_plus_dependency(offline = FALSE)element_plus_dependency() element_plus_dependency(offline = FALSE)
Updates and method calls – update_vue(), call_vue(), every
update_el_*() and call_el() – are sent as Shiny's own
update*Input() are: with the flush, once the observer that made them,
and the rest of the flush, is done. An update made before a long
computation in the same observer therefore shows after it.
flush_vue() sends them at once: wrapped around the updates, it runs
them and sends what is queued; called alone, it sends what is queued so
far.
flush_vue(expr = NULL, session = shiny::getDefaultReactiveDomain())flush_vue(expr = NULL, session = shiny::getDefaultReactiveDomain())
expr |
Code making updates, run before they are sent. |
session |
Shiny session; the current one by default. |
Often there is a better way: a long computation in an
shiny::ExtendedTask leaves the observer at once, and the update goes
with that flush. A component library may send some updates at once by
their nature – a progress bar, as shiny::withProgress() does.
Only the components' messages are sent: outputs are still calculated with the flush, as Shiny does.
The value of expr, invisibly.
if (interactive()) { # inside a server function observeEvent(input$run, { flush_vue({ update_el_table(session, "tbl", loading = TRUE) }) result <- slow_query() update_el_table(session, "tbl", data = result, loading = FALSE) }) }if (interactive()) { # inside a server function observeEvent(input$run, { flush_vue({ update_el_table(session, "tbl", loading = TRUE) }) result <- slow_query() update_el_table(session, "tbl", data = result, loading = FALSE) }) }
Element's addable and editable tabs leave adding to the app: clicking "+"
reports input$<id>_tab_add, and the app decides what the new tab holds.
These are how, in the manner of shiny::insertTab() and
shiny::removeTab(). The content may hold any UI, this package's
components included.
insert_el_tab( session = shiny::getDefaultReactiveDomain(), id, tab, label = NULL, content = NULL, closable = NULL, select = TRUE ) remove_el_tab(session = shiny::getDefaultReactiveDomain(), id, name)insert_el_tab( session = shiny::getDefaultReactiveDomain(), id, tab, label = NULL, content = NULL, closable = NULL, select = TRUE ) remove_el_tab(session = shiny::getDefaultReactiveDomain(), id, name)
session |
Shiny session; the current one by default, as for
|
id |
Tabs ID (un-namespaced). |
tab |
The new tab: an |
label, content
|
The new tab's label and content, when |
closable |
Whether it can be closed. |
select |
Whether to switch to it. Default |
name |
For |
Called for its side effect; returns NULL invisibly.
if (interactive()) { library(shiny) ui <- el_page(el_tabs( "docs", editable = TRUE, tabs = list( el_tab_pane("Tab 1", tags$p("First"), name = "t1") ) )) server <- function(input, output, session) { n <- 1 observeEvent(input$docs_tab_add, { n <<- n + 1 insert_el_tab( session, "docs", el_tab_pane(paste("Tab", n), tags$p("New"), name = paste0("t", n)) ) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) ui <- el_page(el_tabs( "docs", editable = TRUE, tabs = list( el_tab_pane("Tab 1", tags$p("First"), name = "t1") ) )) server <- function(input, output, session) { n <- 1 observeEvent(input$docs_tab_add, { n <<- n + 1 insert_el_tab( session, "docs", el_tab_pane(paste("Tab", n), tags$p("New"), name = paste0("t", n)) ) }) } shinyApp(ui, server) }
A prop that takes a function – a table's formatter, a tree's
filter_node_method, a date picker's shortcuts – takes JavaScript source
marked with JS(), which the page evaluates rather than passing on as
text. It is the same mark htmlwidgets::JS() makes, so either works, and
so does DT::JS().
JS(...)JS(...)
... |
JavaScript source, as one or more strings, joined by newlines. |
The source, classed "JS_EVAL".
JS("function(row, column, value) { return value.toFixed(2); }")JS("function(row, column, value) { return value.toFixed(2); }")
An output that sends a component's data – some of its fields, by name
– rather than markup: the server renders list(mean = 1, sd = 2) and the
fields mean and sd of every component following the output take those
values; the template redraws what depends on them, and nothing else is
touched. It is the declarative twin of update_vue(), with the same
rule: a field must be declared in the component's data (or returned by
setup()), as Vue tracks only the fields a component starts with; one it
does not have is left alone, with a warning in the browser's console.
Fields not in a render keep their values.
render_vue_data(expr, env = parent.frame(), quoted = FALSE) vue_data_output(outputId)render_vue_data(expr, env = parent.frame(), quoted = FALSE) vue_data_output(outputId)
expr |
An expression returning the fields: a named list. |
env, quoted
|
As for |
outputId |
The output's id. Only needed to place the output by
hand: a component listing it in |
The component names the output in its outputs (vue_app(outputs = "stats"), inside a module ns("stats")). It is an output like any
other: rendered again when what it reads changes, held back while its
component is hidden, an error shown as Shiny shows one, a promise – an
ExtendedTask's result – waited for. While it recalculates,
$recalculating.<id> is true in the component's templates. It can be
cached with shiny::bindCache().
Values travel as vue_app()'s data does: a list an object, a
data.frame its rows, JS() a function; I() keeps a vector of one an
array.
Where render_vue() draws a component the server writes, this fills one
the UI writes: the template stays where it is, the data comes from the
server. One output can feed several components, or a vue_store() they
all read – shared state, as Vue's guide recommends, with the server as
its source. As shinyreact's reactive_output() does for React.
render_vue_data(), a render function; vue_data_output(), a
tag.
vue_app(), vue_store(), update_vue().
if (interactive()) { library(shiny) ui <- fluidPage( sliderInput("n", "Draws", 10, 1000, 100), vue_app( "summary", template = htmltools::tags$p( `:style` = "{opacity: $recalculating.stats ? 0.5 : 1}", "Mean {{ mean }}, sd {{ sd }}" ), data = list(mean = NA, sd = NA), outputs = "stats" ) ) server <- function(input, output, session) { output$stats <- render_vue_data({ x <- rnorm(input$n) list(mean = round(mean(x), 3), sd = round(sd(x), 3)) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) ui <- fluidPage( sliderInput("n", "Draws", 10, 1000, 100), vue_app( "summary", template = htmltools::tags$p( `:style` = "{opacity: $recalculating.stats ? 0.5 : 1}", "Mean {{ mean }}, sd {{ sd }}" ), data = list(mean = NA, sd = NA), outputs = "stats" ) ) server <- function(input, output, session) { output$stats <- render_vue_data({ x <- rnorm(input$n) list(mean = round(mean(x), 3), sd = round(sd(x), 3)) }) } shinyApp(ui, server) }
<template> tag for Vue/Element Plus slot usageGenerate a <template> tag for Vue/Element Plus slot usage
template(..., slot = NULL, scope = NULL)template(..., slot = NULL, scope = NULL)
... |
Content inside the template |
slot |
Slot name (optional) |
scope |
Slot scope or v-slot syntax (optional) |
A Shiny UI element.
# Basic usage with text template("Hello World") # With slot name template("Custom content", slot = "header") # With HTML tag content template(shiny::tags$a(href = "https://posit.co", "Posit"), slot = "footer") # Combine multiple tags template( shiny::tags$span("A"), shiny::tags$span("B"), slot = "extra" ) # Custom dateCell slot with check mark (Unicode) template( shiny::tags$p( `:class` = "data.isSelected ? 'is-selected' : ''", "{{ data.day.split('-').slice(1).join('-') }}", shiny::tags$span("\u2714\ufe0f", `v-if` = "data.isSelected") ), slot = "date-cell", scope = "{date, data}" )# Basic usage with text template("Hello World") # With slot name template("Custom content", slot = "header") # With HTML tag content template(shiny::tags$a(href = "https://posit.co", "Posit"), slot = "footer") # Combine multiple tags template( shiny::tags$span("A"), shiny::tags$span("B"), slot = "extra" ) # Custom dateCell slot with check mark (Unicode) template( shiny::tags$p( `:class` = "data.isSelected ? 'is-selected' : ''", "{{ data.day.split('-').slice(1).join('-') }}", shiny::tags$span("\u2714\ufe0f", `v-if` = "data.isSelected") ), slot = "date-cell", scope = "{date, data}" )
The Vue layer's update*Input(): assigns fields of a component's state
– its data, or what its setup() returned, or a vue_store()'s –
and the component, and every template showing them, follow. As with
Shiny's updaters, the component's value is reported back to
input$<id> afterwards, and the update is sent with the flush, after
the outputs (flush_vue()).
update_vue( session = shiny::getDefaultReactiveDomain(), id, ..., value = NULL, insert = NULL, replace = NULL, delete = NULL, at = NULL, key = NULL, set = NULL )update_vue( session = shiny::getDefaultReactiveDomain(), id, ..., value = NULL, insert = NULL, replace = NULL, delete = NULL, at = NULL, key = NULL, set = NULL )
session |
Shiny session; the current one by default, as for
|
id |
The component's id (un-namespaced). |
... |
Fields to set, |
value |
The component's value: sets whichever field its |
insert, replace, delete
|
Rows to insert, rows to put in place of
others, or the rows to delete – each |
at |
Positions, counting from 1: where |
key |
A field the rows are found by, instead of positions. |
set |
Values at paths, |
A field given in ... is replaced whole. A long list, or a deep object,
can be changed in place instead, sending only what changes:
insert, replace, delete: rows of a list field – one field per
call, list(items = rows). Rows are a data.frame or a list of rows.
at says where, counting from 1: the position insert goes before
(the end when NULL), the positions replace and delete change. With
key, rows are found by that field's value instead: replace puts
each row in place of the one with its key (or at the end), and
delete = list(items = c("a", "c")) takes away the rows with those
keys.
set: values at paths, list("items[3].done" = TRUE, "user.name" = "Ann") – fields, then list positions counting from 1 and names.
Called for its side effect; returns NULL invisibly.
vue_app(), call_vue(), flush_vue().
if (interactive()) { # inside a server function update_vue(id = "counter", value = 0) update_vue(id = "cart", note = "Free delivery today") # a list changed in place: one row added, one ticked update_vue(id = "todo", insert = list(items = list(text = "Call Ann"))) update_vue(id = "todo", set = list("items[2].done" = TRUE)) update_vue(id = "todo", delete = list(items = "t3"), key = "id") }if (interactive()) { # inside a server function update_vue(id = "counter", value = 0) update_vue(id = "cart", note = "Free delivery today") # a list changed in place: one row added, one ticked update_vue(id = "todo", insert = list(items = list(text = "Call Ann"))) update_vue(id = "todo", set = list("items[2].done" = TRUE)) update_vue(id = "todo", delete = list(items = "t3"), key = "id") }
What el_page() gives a page, for other page functions –
bslib::page_sidebar(), shiny::navbarPage(): the theme Element follows,
its locale and global config, the handlers of el_message() and the other
feedback services, and Element served from the CDN when offline = FALSE.
Components need none of it to work: each carries Vue and Element Plus, so
on a page without use_element() they show in English, Element's own
colours and sizes. Place it before the components, so its copy of
Element is the one kept.
use_element( theme = NULL, offline = TRUE, dev = .vue_dev(), locale = getOption("shiny.element.locale", "en"), size = NULL, z_index = NULL, layout_css = el_layout_css_dependency() )use_element( theme = NULL, offline = TRUE, dev = .vue_dev(), locale = getOption("shiny.element.locale", "en"), size = NULL, z_index = NULL, layout_css = el_layout_css_dependency() )
theme |
The page's theme – an |
offline |
Serve Element Plus from the copy bundled with this package
rather than the unpkg CDN. See |
dev |
Load Vue's development build ( |
locale |
Language for Element Plus's built-in text. English by default,
or |
size, z_index
|
Element Plus's global config, as |
layout_css |
Element's layout CSS, |
A list of htmlDependency objects
theme <- el_theme(primary = "#7c3aed") ui <- bslib::page_sidebar( theme = theme, use_element(theme = theme), el_button("btn1", "Click me") )theme <- el_theme(primary = "#7c3aed") ui <- bslib::page_sidebar( theme = theme, use_element(theme = theme), el_button("btn1", "Click me") )
A component that needs the server – a lazy tree its children, a remote
search its matches – asks with shinyVue.ask(input, question) in the
browser: the question arrives as an input, with a request number, and
the component waits for the answer. This sends it, or refuses (failed),
which rejects the component's promise.
vue_answer( session = shiny::getDefaultReactiveDomain(), id, request, value = NULL, failed = FALSE )vue_answer( session = shiny::getDefaultReactiveDomain(), id, request, value = NULL, failed = FALSE )
session |
Shiny session; the current one by default, as for
|
id |
The component's id (un-namespaced). |
request |
The question as it arrived, or its |
value |
The answer. |
failed |
|
Called for its side effect; returns NULL invisibly.
if (interactive()) { # inside a server function: a component asked input$places_query observeEvent(input$places_query, { q <- input$places_query vue_answer( id = "places", request = q, value = grep(q$text, cities, value = TRUE) ) }) }if (interactive()) { # inside a server function: a component asked input$places_query observeEvent(input$places_query, { q <- input$places_query vue_answer( id = "places", request = q, value = grep(q$text, cities, value = TRUE) ) }) }
vue_app() writes a Vue 3 component in R and places it on the page: the
arguments are Vue's own options, under Vue's own names, and the browser
creates and mounts it with Vue.createApp(). Three things are added, as
Shiny needs them: id, where it goes and what the server calls it;
input, the field that is input$<id>; and dependencies. use is
Vue's app.use().
vue_app( id, template, data = list(), methods = NULL, computed = NULL, watch = NULL, emits = NULL, setup = NULL, components = NULL, ..., input = NULL, type = NULL, rate = NULL, outputs = NULL, use = NULL, dependencies = NULL, events = NULL, on = NULL )vue_app( id, template, data = list(), methods = NULL, computed = NULL, watch = NULL, emits = NULL, setup = NULL, components = NULL, ..., input = NULL, type = NULL, rate = NULL, outputs = NULL, use = NULL, dependencies = NULL, events = NULL, on = NULL )
id |
The component's id: |
template |
The template: htmltools tags, or a string. |
data |
Named list: the initial state. A data.frame in it is rows.
A vector of one
element travels as a single value, as in Shiny; wrap it in |
methods, computed, watch
|
Named lists of |
emits |
Names of the events the component sends with |
setup |
A |
components |
Named list of |
... |
Any other option of Vue's, by Vue's name or its snake_case:
|
input |
The field whose value is |
type |
An input handler for the value, as Shiny's inputs have:
the name given to |
rate |
How often the value is sent while it changes: |
outputs |
Ids of outputs the component's |
use |
Vue plugins to install: by the global name each is loaded
under, |
dependencies |
|
events |
Events of the template's root – a library's component
there, or a DOM event – each reported as |
on |
Handlers of your own for events of the template's root: a
named list of |
A tag, with its dependencies.
| Vue | Here |
createApp(options).mount('#app') |
vue_app(id, ...) |
data(), methods, computed, watch, setup(), emits, hooks |
the same names; functions as JS() |
beforeUnmount, inheritAttrs, ... |
Vue's name, or snake_case: before_unmount |
app.use(Plugin, options) |
use = list(Plugin = options) |
v-model on the component (its value) |
input = "<field>": input$<id> |
this.$emit("picked", x) |
input$<id>_picked, for an event in emits
|
Every function – a method, a watcher, setup() – is JavaScript, given
with JS(). data is the initial state, as R writes it: a list becomes
an object, a data.frame its rows. After that the component changes it,
and the server does with update_vue() or render_vue().
input$<id> – the input field, on load, on change and after an
update; several fields give one value, a named list of them.
input$<id>_<event> – each event in emits, sent with $emit():
one argument as it is, several as a list (arg1, arg2, ...), none as
TRUE.
Show it through data – {{ field }}, :prop="field" – which Vue
renders as text. Never paste it into the template: a template is code,
and {{ }} in it runs.
vue_component(), vue_store(), update_vue(), call_vue(),
render_vue().
counter <- vue_app( "counter", template = htmltools::tags$button(`@click` = "n++", "Clicked {{ n }} times"), data = list(n = 0), input = "n" ) if (interactive()) { library(shiny) shinyApp( fluidPage(counter, textOutput("n")), function(input, output) output$n <- renderText(input$counter) ) }counter <- vue_app( "counter", template = htmltools::tags$button(`@click` = "n++", "Clicked {{ n }} times"), data = list(n = 0), input = "n" ) if (interactive()) { library(shiny) shinyApp( fluidPage(counter, textOutput("n")), function(input, output) output$n <- renderText(input$counter) ) }
Vue's component options for one component that vue_app() registers
under components =: components = list(todo_item = vue_component(...))
is <todo-item> in the template, and <todo_item> as written. As in Vue, a child takes props and
sends emits to its parent's template (@toggle="..."); data gives
each instance its own copy.
vue_component( template, props = NULL, emits = NULL, data = NULL, methods = NULL, computed = NULL, watch = NULL, setup = NULL, ..., dependencies = NULL )vue_component( template, props = NULL, emits = NULL, data = NULL, methods = NULL, computed = NULL, watch = NULL, setup = NULL, ..., dependencies = NULL )
template |
The child's template: tags or a string. |
props |
Names of its props, or Vue's object form as a list. |
emits |
Names of the events it sends with |
data |
Named list: each instance's initial state. |
methods, computed, watch
|
Named lists of |
setup |
A |
... |
Any other option of Vue's, by Vue's name or its snake_case –
|
dependencies |
|
A list of Vue options, of class vue_component.
item <- vue_component( template = "<li @click=\"$emit('toggle')\">{{ text }}</li>", props = "text", emits = "toggle" )item <- vue_component( template = "<li @click=\"$emit('toggle')\">{{ text }}</li>", props = "text", emits = "toggle" )
vue_output() and render_vue() are the Vue layer's pair, as
shiny::uiOutput() and shiny::renderUI() are Shiny's, with one
difference. renderUI() replaces what it drew on every render, and with it
whatever the user had done: a table's sort, a tree's open nodes, the tab
they were on. render_vue() applies a render as a change, comparing the
server's last render, its new one and the page:
vue_output(id) render_vue(expr, env = parent.frame(), quoted = FALSE)vue_output(id) render_vue(expr, env = parent.frame(), quoted = FALSE)
id |
Output id. |
expr |
An expression returning UI: one component or several, with any markup around them. |
env, quoted
|
As for |
markup the server did not change stays as the page has it;
text and attributes the server changed are set;
each component whose template and options are unchanged gets only the
data fields the server changed since its last render – so a field
the user changed and the server did not keeps the user's value.
Anything structural – an element added or removed, a component's
template or options changed, a component given another id – renders
afresh, as renderUI() does. (A component given no id draws a random one
each render; that is not a change.) To
keep a component, put what changes from render to render in its data
and keep its template the same.
A field the server sends with the same value as last time is not sent
again, so it does not undo what the user did; to set a value whatever the
user did, use update_vue().
vue_output(), a tag; render_vue(), a render function.
Three ways the server shapes a component, by who owns it:
render_vue() – the server writes the component: template, options,
methods, data, dependencies. Rendered again, it keeps what the user did;
a new template or new methods mount it afresh. As shiny.react's
renderReact() is for React.
render_vue_data() – the component is written in the UI and one of
its fields follows a value the server renders: a value, not markup, for
components whose structure is fixed. One output can feed several
components, or a vue_store() they share.
update_vue() – an observer sets fields when it decides to: an
imperative change, sent whether or not the component is shown.
render_vue() can be cached with shiny::bindCache(), as renderUI()
can.
vue_app(), update_vue(), render_vue_data().
if (interactive()) { library(shiny) ui <- fluidPage( sliderInput("n", "Rows", 1, 10, 5), vue_output("list") ) server <- function(input, output, session) { output$list <- render_vue(vue_app( "items", template = htmltools::tags$ul(htmltools::tags$li( `v-for` = "i in items", "{{ i }}" )), data = list(items = as.list(seq_len(input$n))) )) } shinyApp(ui, server) }if (interactive()) { library(shiny) ui <- fluidPage( sliderInput("n", "Rows", 1, 10, 5), vue_output("list") ) server <- function(input, output, session) { output$list <- render_vue(vue_app( "items", template = htmltools::tags$ul(htmltools::tags$li( `v-for` = "i in items", "{{ i }}" )), data = list(items = as.list(seq_len(input$n))) )) } shinyApp(ui, server) }
Each vue_app() is an application of its own, so Vue's provide and
inject cannot reach from one to another. Vue's guide answers shared
state with a store, one reactive() object every component refers to,
and this is that: every template reads and writes it as
$store.<id>.<field>, at once and in the browser. It is also a component
of the bridge, so the server reaches it the way it reaches any other:
input makes fields input$<id>, update_vue() sets them – and every
template showing them follows – and a bookmark restores them.
vue_store(id, data = list(), input = NULL, outputs = NULL)vue_store(id, data = list(), input = NULL, outputs = NULL)
id |
The store's id: |
data |
Named list: the initial state. |
input |
Fields reported as |
outputs |
Outputs the store's data follows, as for |
A store can be anywhere on the page; stores are set up before the components that read them.
A tag: a hidden host that holds the store.
vue_store("cart", data = list(count = 0), input = "count") vue_app("add", htmltools::tags$button(`@click` = "$store.cart.count++", "Add")) vue_app("show", htmltools::tags$span("{{ $store.cart.count }} in the cart"))vue_store("cart", data = list(count = 0), input = "count") vue_app("add", htmltools::tags$button(`@click` = "$store.cart.count++", "Add")) vue_app("show", htmltools::tags$span("{{ $store.cart.count }} in the cart"))