collapsePane: Collapsible panes

View source: R/collapse.R

collapsePaneR Documentation

Collapsible panes

Description

The collapsePane() creates a collapsible container. The state of the container, expanded or collapsed, is toggled using showCollapsePane(), hideCollapsePane(), and toggleCollapsePane().

Usage

collapsePane(id, ..., show = FALSE, animate = TRUE)

hideCollapsePane(id, session = getDefaultReactiveDomain())

showCollapsePane(id, session = getDefaultReactiveDomain())

toggleCollapsePane(id, session = getDefaultReactiveDomain())

Arguments

id

A character string specifying the id of the collapse pane.

...

Tag elements inside the collapsible pane or additional named arguments passed as HTML attributes to parent element.

show

One of TRUE or FALSE specifying if the collapsible pane is shown when the page renders, defaults to FALSE.

animate

One of TRUE or FALSE specifying if showing and closing the collapsible pane is animated, defaults to TRUE.

session

A reactive context, defaults to getDefaultReactiveDomain().

Details

Padding may not be applied to the collapsible pane div element. To pad a collapsible pane first wrap the pane in another element and add padding to this new element.

App with collapse

ui <- container(
  buttonInput(
    id = "demo",
    label = "Toggle collapse"
  ),
  collapsePane(
    id = "collapse",
    p(
      "Pellentesque condimentum, magna ut suscipit hendrerit, ",
      "ipsum augue ornare nulla, non luctus diam neque sit amet urna."
    ),
    p(
      "Praesent fermentum tempor tellus.  Vestibulum convallis, ",
      "lorem a tempus semper, dui dui euismod elit, vitae placerat ",
      "urna tortor vitae lacus."
    )
  )
)

server <- function(input, output) {
  observeEvent(input$demo, {
    toggleCollapsePane("collapse")
  })
}

shinyApp(ui, server)

See Also

Other components: alert(), badge(), blockquote(), card(), d1(), dropdown(), img(), jumbotron(), modal(), navContent(), popover(), pre(), toast()

Examples


### Examples

# As these are server-side utilities, please run the example applications
# above.


nteetor/yonder documentation built on June 8, 2022, 1:36 p.m.