# Basic action with icon
calcite_action(
text = "Layers",
icon = "layers",
id = "layers-action"
)
# Active action with text label
calcite_action(
text = "Settings",
icon = "gear",
active = TRUE,
text_enabled = TRUE
)
# Action with indicator
calcite_action(
text = "Notifications",
icon = "bell",
indicator = TRUE
)
# Shiny example
if (interactive()) {
library(shiny)
ui <- calcite_shell(
calcite_action(
id = "my_action",
text = "Click me",
icon = "check",
text_enabled = TRUE
),
verbatimTextOutput("status")
)
server <- function(input, output, session) {
# Respond to clicks
observeEvent(input$my_action$clicked, {
message("Action clicked! State: ", input$my_action$clicked)
})
# Display all properties
output$status <- renderPrint({
input$my_action
})
}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab