Learn R Programming

dqshiny (version 0.0.3)

icon_state_button: Creates a state button showing different icons

Description

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.

Usage

icon_state_button(id, states, value = NULL, ...)

update_icon_state_button(session, id, states = NULL, value = NULL)

Arguments

id

id of the element

states

character of possible states, must be valid FontAwesome icon names icon

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

Value

icon_state_button: shiny input element

update_icon_state_button: message to the client

Examples

Run this code
# NOT RUN {
## Only run examples in interactive R sessions
if (interactive()) {

library(shiny)
hands <- paste0("hand-o-", 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-o", "meh-o", "frown-o"), "smile-o"),
      br(), actionButton("makeStars", "I like stars")
    ))
  ),
  server = function(input, output, session) {
    observeEvent(input$makeStars, update_icon_state_button(
      session, "mood", c("star", "star-half-o", "star-o"), "star"
    ))
  }
)

}
# }

Run the code above in your browser using DataLab