dq_drawer: Creates a drawer sidebar element

Description Usage Arguments Value Author(s) Examples

View source: R/dq_drawer.R

Description

Creates a drawer element with buttons to draw out different content elements.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
dq_drawer(
  id = NULL,
  ...,
  drawer_style = NULL,
  btn_style = NULL,
  size = NULL,
  direction = c("left", "right", "top", "bottom")
)

update_dq_drawer(id, open)

Arguments

id

optional element id, useful if current state is needed

...

content elements, must be named since those will be used as button labels, can also be a named list

drawer_style, btn_style

optional character specifying additional styles

size

optional size of the drawer (width or height depending on direction), can be any valid CSS unit (see validateCssUnit)

direction

optional, specifies the direction the drawer comes from, one of c("left", "right", "top", "bottom)

open

name of the content element to show, NULL to close drawer

Value

drawer element tag

Author(s)

richard.kunze

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
## Only run examples in interactive R sessions
if (interactive()) {

library(shiny)
shinyApp(
  ui = fluidPage(
    dq_drawer(
      id = "myDrawer",
      Config = div(actionButton("hide", "Close drawer")),
      Red = div(style = "background: red;width: 100%;height: 100%;"),
      "Green Color!" = div("RED!!!!", style = "background: green;"),
      direction = "left", size = 250
    ),
    fluidRow(column(
      3, offset = 5,
      "Current page:", textOutput("drawerVal"),
      actionButton("show", "Show Green")
    ))
  ),
  server = function(input, output) {
    output$drawerVal <- renderText(input$myDrawer)
    observeEvent(input$show, update_dq_drawer("myDrawer", "Green Color!"))
    observeEvent(input$hide, update_dq_drawer("myDrawer", NULL))
  }
)

}

daqana/dqshiny documentation built on Sept. 1, 2020, 4:31 p.m.