Skip to contents

Update a rating from the server

Usage

update_shad_rating(
  id,
  value = NULL,
  readonly = NULL,
  session = shiny::getDefaultReactiveDomain()
)

Arguments

id

Input id (namespaced automatically).

value

Optional new rating.

readonly

Optional logical toggling display-only mode.

session

The Shiny session.

Value

Invisibly NULL.

Examples

if (interactive()) {
  ui <- page_shad(
    shad_rating("stars", "Your rating", value = 3),
    shad_button("Lock rating", inputId = "lock")
  )
  server <- function(input, output, session) {
    shiny::observeEvent(input$lock, update_shad_rating("stars", readonly = TRUE))
  }
  shiny::shinyApp(ui, server)
}