addWidget: Adds a new widget to the dock

Description Usage Arguments Value See Also Examples

View source: R/luminophor.R

Description

Adds a new widget to the dock

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
addWidget(
  proxy,
  id,
  title = "Widget",
  caption = "Widget",
  icon = "",
  closable = TRUE,
  insertmode = "tab-after",
  refwidgetID = NULL,
  relsize = NULL,
  ui = shiny::HTML("I am a widget!")
)

Arguments

proxy

Either output from the luminophor function, or a Proxy LuminophoR object

id

ID for luminophor widget

title

Title for luminophor widget

caption

Caption for luminophor widget

icon

Font Awesome icon (specified via the icon function)

closable

Create removable

insertmode

How should the widget be added? Options include split-right, split-left, split-bottom, split-top, tab-before, and tab-after (default)

refwidgetID

Reference widget ID for insertmode action

relsize

Relative size of widget (between 0 and 1) in relation to refwidget (or last widget if refwidget isn't specified)

ui

UI content. If just text, need to use HTML(...)

Value

Proxy LuminophoR object

See Also

removeWidgets

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Add widget on render
if (interactive()) {
  library(shiny)
  library(luminophor)
  shinyApp(
    ui = fluidPage(
      fluidRow(column(12, luminophorOutput('lmo', height='90vh')))
    ),
    server = function(input, output) {
      output$lmo <- renderLuminophor(
        luminophor() %>%
          addWidget("mywidget")
      )
    }
  )
}

# Add widget on event
if (interactive()) {
  library(shiny)
  library(luminophor)
  shinyApp(
    ui = fluidPage(
      sidebarLayout(
        sidebarPanel(
          actionButton('add', 'Add Widgets', icon = icon('plus'))
        ),
        mainPanel(
          luminophorOutput('lmo', height='90vh')
        )
      )
    ),
    server = function(input, output) {
      output$lmo <- renderLuminophor(
        luminophor()
      )

      observeEvent(input$add, {
        luminophorProxy('lmo') %>%
          addWidget("mywidget")
      })
    }
  )
}

serenity-r/luminophor documentation built on Oct. 28, 2020, 9:42 p.m.