dropdownMenu2: Create a custom dropdown menu to place in a dashboard header

Description Usage Examples

Description

Create a custom dropdown menu to place in a dashboard header

Usage

1
2
dropdownMenu2(..., status = "primary", btnstyle = NULL, dropstyle = NULL,
  icon = "toggle-down", .list = NULL, taglist = FALSE)

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
## Only run this example in interactive R sessions
if (interactive()) {
  library(shiny)
  library(shinydashboard)

  # A dashboard header with 3 dropdown menus
  header <- dashboardHeader(
    title = "Dashboard Demo",

    # Dropdown menu for messages
    dropdownMenu(
      type = "messages", badgeStatus = "success",
      messageItem("Support Team",
                  "This is the content of a message.",
                  time = "5 mins"
      ),
      messageItem("Support Team",
                  "This is the content of another message.",
                  time = "2 hours"
      ),
      messageItem("New User",
                  "Can I get some help?",
                  time = "Today"
      )
    ),

    # Dropdown menu for notifications
    dropdownMenu(
      type = "notifications", badgeStatus = "warning",
      notificationItem(icon = icon("users"), status = "info",
                       "5 new members joined today"
      ),
      notificationItem(icon = icon("warning"), status = "danger",
                       "Resource usage near limit."
      ),
      notificationItem(icon = icon("shopping-cart", lib = "glyphicon"),
                       status = "success", "25 sales made"
      ),
      notificationItem(icon = icon("user", lib = "glyphicon"),
                       status = "danger", "You changed your username"
      )
    ),

    # Dropdown menu for tasks, with progress bar
    dropdownMenu(
      type = "tasks", badgeStatus = "danger",
      taskItem(value = 20, color = "aqua",
               "Refactor code"
      ),
      taskItem(value = 40, color = "green",
               "Design new layout"
      ),
      taskItem(value = 60, color = "yellow",
               "Another task"
      ),
      taskItem(value = 80, color = "red",
               "Write documentation"
      )
    ),
    uiOutput("ddm", container = tags$li, class = "dropdown")
  )

  shinyApp(
    ui = dashboardPage(
      header,
      dashboardSidebar(),
      dashboardBody()
    ),
    server = function(input, output) {
      output$ddm <- renderUI({
        #' Dropdown menu for custom
        dropdownMenu2(
          taglist = TRUE,
          dropstyle = 'width:240px;',
          selectInput(
            inputId = "mtcars_vs", label = 'mtcars_vs', choices = unique(mtcars$vs)),
          selectInput(
            inputId = "mtcars_vs", label = "mtcars_am", choices = unique(mtcars$am))
        )
      })
    }
  )
}

jeevanyue/ShinyFuncs documentation built on May 24, 2019, 7:14 a.m.