md_header: Create a dashboard header

Description Usage Arguments Examples

Description

Create a dashboard header

Usage

1

Arguments

...

Items to put in the dashboard header.

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
if (interactive()) {
  library(shiny)
  library(shinymd)

  ui = md_page(
    header = md_header(
      md_dropdown_menu(
        icon = md_icon('shopping_cart'),
        md_dropdown_menu_item('Message 1'),
        md_dropdown_menu_item('Message 2')
      ),

      # Create dropdown menu programmatically (UI-side)
      md_dropdown_menu_output('dropdown_menu')
    ),
    sidebar = md_sidebar(),
    body = md_body()
  )

  server = function(input, output) {
    # Create dropdown menu programmatically (server-side)
    output$dropdown_menu = md_render_dropdown_menu({

      # Assuming the dropdown menu's message stored in a list
      notif = list(
        'Message 3',
        'Message 4',
        'Message 5'
      )

      items = lapply(notif, function(x) {
        md_dropdown_menu_item(x)
      })

      md_dropdown_menu(
        icon = md_icon('notifications'),
        items
      )
    })
  }

  shinyApp(ui, server)
}

pythonjokeun/shinymd documentation built on May 12, 2019, 10:52 a.m.