View source: R/lottie_button.R
lottie_button | R Documentation |
Wraps a 'Lottie' animation within a button element for use in 'shiny' applications.
lottie_button(
animation,
inputId,
label = NULL,
width = NULL,
height = NULL,
...
)
animation |
A 'Lottie' animation created by |
inputId |
The 'shiny' |
label |
Optional text label to display below the animation inside the button. |
width |
Width of the button. This is validated using |
height |
Height of the button. This is validated using |
... |
Additional named attributes to pass to the button element. Same behaviour as |
An HTML button element enclosing the animation
input object.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.