Title: | CSS Animations for 'shiny' Button Elements |
---|---|
Description: | A wrapper around a CSS library called 'Hover.css', intended for use in 'shiny' applications. |
Authors: | Tyler Littlefield [aut, cre] (Creator of Shiny Wrapper), Ian Lunn [ctb, cph] (Author of included CSS code), Danube Huynhle [ctb] |
Maintainer: | Tyler Littlefield <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1 |
Built: | 2024-11-23 03:46:48 UTC |
Source: | https://github.com/r4fun/hover |
A list containing all available animations.
animations
animations
An object of class list
of length 7.
Source: https://github.com/IanLunn/Hover
Animate an actionButton and it's icon using Hover.css
hover_action_button( inputId, label, icon = NULL, button_animation = NULL, icon_animation = NULL, width = NULL, ... )
hover_action_button( inputId, label, icon = NULL, button_animation = NULL, icon_animation = NULL, width = NULL, ... )
inputId |
The input slot that will be used to access the value. |
label |
The contents of the button or link–usually a text label, but you could also use any other HTML, like an image. |
icon |
An optional icon() to appear on the button. |
button_animation |
The name of the button animation. |
icon_animation |
The name of the icon animation. |
width |
The width of the input, e.g. '400px', or '100%'; see validateCssUnit(). |
... |
Named attributes to be applied to the button or link. |
https://github.com/IanLunn/Hover
if (interactive()) { library(shiny) library(hover) ui <- fluidPage( use_hover(), hover_action_button( inputId = "btn", label = "hello hover!", icon = icon("refresh"), button_animation = "rotate", icon_animation = "spin" ) ) server <- function(input, output, session) { } shinyApp(ui, server) }
if (interactive()) { library(shiny) library(hover) ui <- fluidPage( use_hover(), hover_action_button( inputId = "btn", label = "hello hover!", icon = icon("refresh"), button_animation = "rotate", icon_animation = "spin" ) ) server <- function(input, output, session) { } shinyApp(ui, server) }
Animate a downloadButton and it's icon using Hover.css
hover_download_button( outputId, label = "Download", button_animation = NULL, icon_animation = NULL, class = NULL, ... )
hover_download_button( outputId, label = "Download", button_animation = NULL, icon_animation = NULL, class = NULL, ... )
outputId |
The name of the output slot that the downloadHandler is assigned to. |
label |
The label that should appear on the button. |
button_animation |
The name of the button animation. |
icon_animation |
The name of the icon animation. |
class |
Additional CSS classes to apply to the tag, if any. |
... |
Other arguments to pass to the container tag function. |
https://github.com/IanLunn/Hover
if (interactive()) { library(shiny) library(hover) ui <- fluidPage( use_hover(), hover_download_button( outputId = "downloadData", label = "Download", button_animation = "rotate", icon_animation = "spin" ) ) server <- function(input, output) { # Our dataset data <- mtcars output$downloadData <- downloadHandler( filename = function() { paste("data-", Sys.Date(), ".csv", sep="") }, content = function(file) { write.csv(data, file) } ) } shinyApp(ui, server) }
if (interactive()) { library(shiny) library(hover) ui <- fluidPage( use_hover(), hover_download_button( outputId = "downloadData", label = "Download", button_animation = "rotate", icon_animation = "spin" ) ) server <- function(input, output) { # Our dataset data <- mtcars output$downloadData <- downloadHandler( filename = function() { paste("data-", Sys.Date(), ".csv", sep="") }, content = function(file) { write.csv(data, file) } ) } shinyApp(ui, server) }
Animate a reload button and it's icon using Hover.css Note that a reload button is just a shiny::actionButton with onClick behavior to reload or refresh a web browser.
hover_reload_button( inputId, label, icon = NULL, button_animation = NULL, icon_animation = NULL, width = NULL, ... )
hover_reload_button( inputId, label, icon = NULL, button_animation = NULL, icon_animation = NULL, width = NULL, ... )
inputId |
The input slot that will be used to access the value. |
label |
The contents of the button or link–usually a text label, but you could also use any other HTML, like an image. |
icon |
An optional icon() to appear on the button. |
button_animation |
The name of the button animation. |
icon_animation |
The name of the icon animation. |
width |
The width of the input, e.g. '400px', or '100%'; see validateCssUnit(). |
... |
Named attributes to be applied to the button or link. |
https://github.com/IanLunn/Hover
if (interactive()) { library(shiny) library(hover) ui <- fluidPage( use_hover(), hover_reload_button( inputId = "btn", label = "hello hover!", icon = icon("refresh"), button_animation = "rotate", icon_animation = "spin" ) ) server <- function(input, output, session) { } shinyApp(ui, server) }
if (interactive()) { library(shiny) library(hover) ui <- fluidPage( use_hover(), hover_reload_button( inputId = "btn", label = "hello hover!", icon = icon("refresh"), button_animation = "rotate", icon_animation = "spin" ) ) server <- function(input, output, session) { } shinyApp(ui, server) }
Enables hover by including the CSS file necessary for the animations.
use_hover(popback = FALSE)
use_hover(popback = FALSE)
popback |
If true, buttons 'pop back', contrary to default shiny behavior. |
By default, shiny buttons don't 'pop back'. This is for accessibility reasons. For more information see here: https://github.com/rstudio/shiny/issues/2500.
if (interactive()) { library(shiny) library(hover) ui <- fluidPage( use_hover(), hover_action_button( inputId = "btn", label = "hello hover!", icon = icon("refresh"), button_animation = "rotate", icon_animation = "spin" ) ) server <- function(input, output, session) { } shinyApp(ui, server) }
if (interactive()) { library(shiny) library(hover) ui <- fluidPage( use_hover(), hover_action_button( inputId = "btn", label = "hello hover!", icon = icon("refresh"), button_animation = "rotate", icon_animation = "spin" ) ) server <- function(input, output, session) { } shinyApp(ui, server) }