Debian Codegraph @

man/updateActionButton.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/update-input.R
3 \name{updateActionButton}
4 \alias{updateActionButton}
5 \alias{updateActionLink}
6 \title{Change the label or icon of an action button on the client}
7 \usage{
8 updateActionButton(
9 session = getDefaultReactiveDomain(),
10 inputId,
11 label = NULL,
12 icon = NULL,
13 disabled = NULL
14 )
15
16 updateActionLink(
17 session = getDefaultReactiveDomain(),
18 inputId,
19 label = NULL,
20 icon = NULL
21 )
22 }
23 \arguments{
24 \item{session}{The \code{session} object passed to function given to
25 \code{shinyServer}. Default is \code{getDefaultReactiveDomain()}.}
26
27 \item{inputId}{The id of the input object.}
28
29 \item{label}{The label to set for the input object.}
30
31 \item{icon}{An optional \code{\link[=icon]{icon()}} to appear on the button.}
32
33 \item{disabled}{If \code{TRUE}, the button will not be clickable; if \code{FALSE}, it
34 will be.}
35 }
36 \description{
37 Change the label or icon of an action button on the client
38 }
39 \details{
40 The input updater functions send a message to the client, telling it to
41 change the settings of an input object. The messages are collected and sent
42 after all the observers (including outputs) have finished running.
43
44 The syntax of these functions is similar to the functions that created the
45 inputs in the first place. For example, \code{\link{numericInput}()} and
46 \code{updateNumericInput()} take a similar set of arguments.
47
48 Any arguments with NULL values will be ignored; they will not result in any
49 changes to the input object on the client.
50
51 For \code{\link{radioButtons}()}, \code{\link{checkboxGroupInput}()} and
52 \code{\link{selectInput}()}, the set of choices can be cleared by using
53 \code{choices=character(0)}. Similarly, for these inputs, the selected item
54 can be cleared by using \code{selected=character(0)}.
55 }
56 \examples{
57 ## Only run examples in interactive R sessions
58 if (interactive()) {
59
60 ui <- fluidPage(
61 actionButton("update", "Update other buttons and link"),
62 br(),
63 actionButton("goButton", "Go"),
64 br(),
65 actionButton("goButton2", "Go 2", icon = icon("area-chart")),
66 br(),
67 actionButton("goButton3", "Go 3"),
68 br(),
69 actionLink("goLink", "Go Link")
70 )
71
72 server <- function(input, output, session) {
73 observe({
74 req(input$update)
75
76 # Updates goButton's label and icon
77 updateActionButton(session, "goButton",
78 label = "New label",
79 icon = icon("calendar"))
80
81 # Leaves goButton2's label unchanged and
82 # removes its icon
83 updateActionButton(session, "goButton2",
84 icon = character(0))
85
86 # Leaves goButton3's icon, if it exists,
87 # unchanged and changes its label
88 updateActionButton(session, "goButton3",
89 label = "New label 3")
90
91 # Updates goLink's label and icon
92 updateActionButton(session, "goLink",
93 label = "New link label",
94 icon = icon("link"))
95 })
96 }
97
98 shinyApp(ui, server)
99 }
100 }
101 \seealso{
102 \code{\link[=actionButton]{actionButton()}}
103 }