Convert a 'Lottie' Animation to a Button
lottie_button.Rd
Wraps a 'Lottie' animation within a button element for use in 'shiny' applications.
Arguments
- animation
A 'Lottie' animation created by
lottie_animation
.- inputId
The 'shiny'
input
slot that will be used to access the value.- label
Optional text label to display below the animation inside the button.
- width
Width of the button. This is validated using
validateCssUnit
.- height
Height of the button. This is validated using
validateCssUnit
.- ...
Additional named attributes to pass to the button element. Same behaviour as
actionButton
.
Examples
if (FALSE) { # interactive()
library(shiny)
library(shinyLottie)
ui <- fluidPage(
include_lottie(),
lottie_animation(
path = "shinyLottie/example.json",
name = "my_animation",
height = "100px",
width = "100px"
) |> lottie_button(inputId = "my_button")
)
server <- function(input, output, session) {
observeEvent(input$my_button, {
print("Button pressed")
})
}
shinyApp(ui, server)
}