Learn R Programming

yonder (version 0.1.1)

collapsiblePane: Collapsible sections

Description

The collapsiblePane() creates a collapsible container. The state of the container, expanded or collapsed, is toggled using expandPane(), collapsePane(), and togglePane().

Usage

collapsiblePane(id, ..., show = FALSE)

collapsePane(id, session = getDefaultReactiveDomain())

expandPane(id, session = getDefaultReactiveDomain())

togglePane(id, session = getDefaultReactiveDomain())

Arguments

id

A character string specifying the id of the collapsible pane. Pass this id to the hideCollapse(), showCollapse(), or toggleCollapse() to change the state of a collapsible 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.

session

A reactive context, defaults to getDefaultReactiveDomain().

App with collapse

ui <- container(
  buttonInput(
    id = "demo",
    label = "Toggle collapse"
  ),
  collapsiblePane(
    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, { togglePane("collapse") }) }

shinyApp(ui, server)

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.

See Also

Other content: alert, blockquote, card, d1, dropdown, img, jumbotron, modal, navContent, popover, pre, toast, tooltip

Examples

Run this code
# NOT RUN {
### Examples

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

# }

Run the code above in your browser using DataLab