Skip to contents

Panels side by side, or one above the other, resized by dragging the bars between them. Give it el_splitter_panel()s.

Usage

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
)

Arguments

...

Its content: any Shiny UI. Components of this package are folded into this one's Vue instance, as el_button_group() folds its buttons.

id

Component ID. Auto-generated if NULL.

layout

Layout direction of the splitter. Element Plus's layout ('horizontal' | 'vertical').

lazy

Whether to enable lazy mode. Element Plus's lazy (boolean).

width

Component width, as a CSS unit.

slots

Named list of Element slot contents. A scoped slot is written with template().

events

Element's events to report besides those reported unasked, by name: events = "node_drop" reports input$<id>_node_drop. The component's are listed under "Shiny inputs", and by el_events(); a name it does not have is an error.

on

Handlers of your own, for an event not reported or to send something else: a named list of JS() functions, one per event – Element's, or a DOM event with Vue's modifiers ("keyup.enter"). Each is called with report and the event's arguments; report(name, value) sets input$<id>_<name>. See el_widget().

session

Shiny session; the current one by default, as for shiny::updateTextInput().

Value

A Shiny UI element.

Shiny inputs

InputReportedValue
input$<id>_resize_startevents = "resize_start"Triggered when starting to resize a panel, index is the drag bar index
input$<id>_resizeevents = "resize"the sizes, at most every 200 ms
input$<id>_resize_endunaskedTriggered when panel resizing ends, index is the drag bar index
input$<id>_collapseunaskedTriggered 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.

Binding

Every argument can follow v_bind() or v_model() except width (the mount point's style).

Updating from the server

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.

Examples

el_splitter(el_splitter_panel("Left", size = "30%"), el_splitter_panel("Right"))
#> <div id="el_splitter_906c076a-8541-48c1-aa4c-4c71c2d48189" data-shiny-vue style="display: contents">
#>   <script type="text/x-template" data-shiny-vue-template><div id="el_splitter_906c076a-8541-48c1-aa4c-4c71c2d48189_container" style="display: contents">
#>   <el-splitter v-bind="$optional(&#39;splitter&#39;)" @resize-end="svEmitResizeEnd" @collapse="svEmitCollapse">
#>     <el-splitter-panel v-bind="$optional(&#39;splitter-panel&#39;)" ref="sv_el_splitter_panel_6f81b237_0032_491c_ac8f_19f6b9bdb538" id="el_splitter_panel_6f81b237-0032-491c-ac8f-19f6b9bdb538">Left</el-splitter-panel>
#>     <el-splitter-panel v-bind="$optional(&#39;el3_splitter-panel&#39;)" ref="sv_el_splitter_panel_5639f92b_3c92_4ad7_ae17_e2e42d053cf9" id="el_splitter_panel_5639f92b-3c92-4ad7-ae17-e2e42d053cf9">Right</el-splitter-panel>
#>   </el-splitter>
#> </div></script>
#>   <script type="application/json" data-shiny-vue-options>{"options":{"data":{"layout":null,"lazy":null,"size":"30%","min":null,"max":null,"resizable":null,"collapsible":null,"el3_size":null,"el3_min":null,"el3_max":null,"el3_resizable":null,"el3_collapsible":null},"methods":{"svEmitResizeEnd":"function() { window.shinyVue.emit('el_splitter_906c076a-8541-48c1-aa4c-4c71c2d48189', 'resize_end', arguments); }","svEmitCollapse":"function() { window.shinyVue.emit('el_splitter_906c076a-8541-48c1-aa4c-4c71c2d48189', 'collapse', arguments); }"}},"input":null,"rate":null,"type":null,"use":["shinyElement.plugin"],"optional":{"splitter":{"layout":"layout","lazy":"lazy"},"splitter-panel":{"size":"size","min":"min","max":"max","resizable":"resizable","collapsible":"collapsible"},"el3_splitter-panel":{"size":"el3_size","min":"el3_min","max":"el3_max","resizable":"el3_resizable","collapsible":"el3_collapsible"}},"absorbed":{"el_splitter_panel_6f81b237-0032-491c-ac8f-19f6b9bdb538":{"fields":{"size":"size","min":"min","max":"max","resizable":"resizable","collapsible":"collapsible"},"ref":"sv_el_splitter_panel_6f81b237_0032_491c_ac8f_19f6b9bdb538"},"el_splitter_panel_5639f92b-3c92-4ad7-ae17-e2e42d053cf9":{"fields":{"size":"el3_size","min":"el3_min","max":"el3_max","resizable":"el3_resizable","collapsible":"el3_collapsible"},"ref":"sv_el_splitter_panel_5639f92b_3c92_4ad7_ae17_e2e42d053cf9"}},"generated":true,"evals":["options.methods.svEmitResizeEnd","options.methods.svEmitCollapse"]}</script>
#> </div>