Description Usage Arguments Value Author(s) Examples
View source: R/icon_state_button.R
Creates a state button showing different states by different icons.
Changes the value or the options of an icon_state_button on the client side.
1 2 3 | icon_state_button(id, states, value = NULL, ...)
update_icon_state_button(session, id, states = NULL, value = NULL)
|
id |
id of the element |
states |
character of possible states, must be valid FontAwesome icon
names |
value |
optional value, can be integer position in states or character giving the state, must be of length one |
... |
additional parameters like CSS classes or styles |
session |
the shiny session object |
icon_state_button: shiny input element
update_icon_state_button: message to the client
richard.kunze
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Only run examples in interactive R sessions
if (interactive()) {
library(shiny)
hands <- paste0("hand-point-", c("up", "right", "down", "left"))
shinyApp(
ui = fluidPage(
fluidRow(column(12,
icon_state_button("sort", c("sort", "sort-up", "sort-down")),
icon_state_button("hands", hands, 1),
icon_state_button("mood", c("smile", "meh", "frown"), "smile"),
br(), actionButton("makeStars", "I like stars")
))
),
server = function(input, output, session) {
observeEvent(input$makeStars, update_icon_state_button(
session, "mood", list(star = dq_icon("star"), dq_icon("star-half"),
dq_icon("star-half", style = "far"), dq_icon("star", style = "far")
), value = "star"
))
}
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.