Adds a new widget to the dock
addWidget(proxy, id, title = "Widget", caption = "Widget", icon = "", closable = TRUE, insertmode = "tab-after", refwidgetID = NULL, relsize = NULL, ui = shiny::HTML("I am a widget!"))
proxy | Either output from the |
---|---|
id | ID for luminophor widget |
title | Title for luminophor widget |
caption | Caption for luminophor widget |
icon | Font Awesome icon (specified via the |
closable | Create removable |
insertmode | How should the widget be added? Options include |
refwidgetID | Reference widget ID for |
relsize | Relative size of widget (between 0 and 1) in relation to |
ui | UI content. If just text, need to use HTML(...) |
# 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") }) } ) }