Description Usage Arguments Details See Also Examples
Button inputs are useful as triggers for reactive or observer expressions.
The reactive value of a button input begins as NULL
, but subsequently is
the number of clicks.
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 | buttonInput(id, label, ..., stretch = FALSE, download = FALSE, tooltip = NULL)
updateButtonInput(
id,
label = NULL,
value = NULL,
disable = NULL,
enable = NULL,
tooltip = NULL,
session = getDefaultReactiveDomain()
)
linkInput(id, label, ..., stretch = FALSE, download = FALSE, tooltip = NULL)
updateLinkInput(
id,
label = NULL,
value = NULL,
enable = NULL,
disable = NULL,
tooltip = NULL,
session = getDefaultReactiveDomain()
)
tooltip(..., placement = "top", fade = TRUE)
|
id |
A character string specifying the id of the reactive input. |
label |
A character string specifying the label text on the button or link input. |
... |
Additional named arguments passed as HTML attributes to the parent element. |
stretch |
One of |
download |
One of |
tooltip |
A call to |
value |
A number specifying a new value for the button, defaults to
|
disable |
if |
enable |
If |
session |
A reactive context, defaults to |
placement |
One of |
fade |
One of |
Tooltips
To remove a button or link input's tooltip pass an empty tooltip,
tooltip()
, to updateButtonInput()
or updateLinkInput()
.
Other inputs:
buttonGroupInput()
,
checkbarInput()
,
checkboxInput()
,
chipInput()
,
fileInput()
,
formInput()
,
listGroupInput()
,
menuInput()
,
navInput()
,
radioInput()
,
radiobarInput()
,
rangeInput()
,
selectInput()
,
textInput()
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 | ### A simple button
buttonInput(
id = "button1",
label = "Simple"
)
# Alternatively, a button can fill the width of its parent element.
buttonInput(
id = "button2",
label = "Full-width",
fill = TRUE # <-
) %>%
background("red")
# Use design utilities to further adjust the width of a button.
buttonInput(
id = "button3",
label = "Full and back again",
fill = TRUE # <-
) %>%
background("red") %>%
width("3/4") # <-
### Possible colors
colors <- c(
"red", "purple", "indigo", "blue", "cyan", "teal", "green",
"yellow", "amber", "orange", "grey"
)
lapply(
colors,
function(color) {
buttonInput(
id = color,
label = color
) %>%
background(color) %>%
margin(2)
}
) %>%
div() %>%
display("flex") %>%
flex(wrap = TRUE)
### Reactive links
div("Curabitur ", linkInput("link1", "vulputate"), " vestibulum lorem.")
### Stretched buttons and links
card(
header = "Card with stretched button",
p("Notice when you hover over the card, the button also detects ",
"the hover."),
buttonInput(
id = "go",
label = "Go go go",
stretch = TRUE
) %>%
background("blue")
) %>%
width(20)
### Download button
buttonInput(
download = TRUE,
id = "download1",
label = "Download",
icon("download")
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.