dropdown: Dropdown menus

Description Usage Arguments See Also Examples

View source: R/dropdown.R

Description

Dropdown menus are a container for buttons, text, and form inputs. See argument ... for details on composing dropdown menus.

Usage

1
dropdown(label, ..., direction = "down", align = "left")

Arguments

label

A character string specifying the label of the dropdown's button.

...

Character strings or vectors, header tag elements, button inputs, or form inputs specifying the elements of the dropdown. These elements may be grouped into lists to create a menu with sections. h6() is the recommended heading level for menu headers. Character vectors are converted into paragraphs of text. To format menu text use p() and utility functions.

Additional named arguments are passed as HTML attributes to the parent element.

direction

One of "up", "right", "down", or "left" specifying the direction in which the menu opens, defaults to "down".

align

One of "left" or "right" specifying which side of the button to align the dropdown menu to, defaults to "left".

See Also

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

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
### Dropdown with buttons

dropdown(
  label = "Choices",
  buttonInput("choice1", "Choice 1"),
  buttonInput("choice2", "Choice 2"),
  buttonInput("choice3", "Choice 3")
)

### Dropdown with links

dropdown(
  label = "Choices",
  linkInput("link1", "Choice 1"),
  linkInput("link2", "Choice 2")
)

### Grouped sections

dropdown(
  label = "Sections",
  h6("Section 1"),
  buttonInput("a", "Option A"),
  buttonInput("b", "Option B"),
  hr(),
  h6("Section 2"),
  buttonInput("c", "Option C"),
  buttonInput("d", "Option D")
)

### Direction variations

dropdown(
  label = "Up!",
  direction = "up",
  buttonInput("up1", "Choice 1"),
  buttonInput("up2", "Choice 2")
)

### Dropdowns with forms

dropdown(
  label = "Sign in",
  formInput(
    id = "login",
    formGroup(
      label = "Username / Email",
      textInput(
        type = "email",
        id = "user"
      )
    ),
    formGroup(
      label = "Password",
      textInput(
        type = "password",
        id = "pass"
      )
    ),
    formSubmit(
      label = "Sign in",
      value = "signin"
    )
  ) %>%
    padding(3, 4, 3, 4)
)

yonder documentation built on Jan. 11, 2020, 9:35 a.m.