SmaRPanel | R Documentation |
Custom collapsible panel for the SmaRP Shiny app.
SmaRPanel(id, ..., title = NULL, collapsed = NA)
id |
The unique id of the panel. |
... |
UI elements to be displayed in the panel body. |
title |
The title to be displayed in the panel heading. |
collapsed |
Whether the panel should be created as collapsed or
expanded. If |
All elements of the panel are specified with additional classes
"panel-smarp"
, "panel-heading-smarp"
, "panel-title-smarp"
,
"panel-body-smarp"
, used for CSS customization. Similarly, the collapse
actionButton()
is defined with no label
nor icon
and has a custom
class "btn-collapse-smarp"
, to be used for CSS customization via the
:after
pseudo-element.
The UI definition of the panel.
if (interactive()) { library(shiny) long_title <- "Lorem ipsum dolor sit amet, consectetur adipisicing elit." ui <- fluidPage( tags$head( includeCSS(system.file("application/www/style.css", package = "SmaRP")) ), titlePanel("SmaRPanel"), icon("cog"), fluidRow( column(2L, SmaRPanel( id = "simple-panel", title = long_title, verticalLayout(textInput("a", "A"), textInput("b", "B")) )), column(2L, SmaRPanel( id = "collapsed-panel", title = long_title, verticalLayout(textInput("a", "A"), textInput("b", "B")), collapsed = FALSE )), column(2L, SmaRPanel( id = "expanded-panel", title = long_title, verticalLayout(textInput("a", "A"), textInput("b", "B")), collapsed = TRUE )), column(2L, SmaRPanel( id = "no-title-panel", verticalLayout(textInput("a", "A"), textInput("b", "B")) )), column(2L, SmaRPanel( id = "no-title-expanded-panel", verticalLayout(textInput("a", "A"), textInput("b", "B")), collapsed = FALSE )) ) ) server <- function(input, output) {} runApp(shinyApp(ui = ui, server = server), launch.browser = TRUE) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.