Skip to content

Commit

Permalink
added icon argument to downloadBttn()
Browse files Browse the repository at this point in the history
  • Loading branch information
pvictor committed Jan 6, 2022
1 parent 3a36041 commit cf3ba12
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 36 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: shinyWidgets
Title: Custom Inputs Widgets for Shiny
Version: 0.6.2.9300
Version: 0.6.2.9400
Authors@R: c(
person("Victor", "Perrier", email = "[email protected]", role = c("aut", "cre", "cph")),
person("Fanny", "Meyer", role = "aut"),
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ shinyWidgets (unreleased)
+ `textInputIcon()`
+ `numericInputIcon()`
* `checkboxGroupButtons()`/`radioGroupButtons()`: `status` argument now accept a vector, thanks to [@jassler](https://github.com/jassler) ([#440](https://github.com/dreamRs/shinyWidgets/pull/440))
* `downloadBttn()` now has a `icon` argument.

### Bug fixes
* `updateNumericRangeInput()` failed to correctly update `label` ([#441](https://github.com/dreamRs/shinyWidgets/issues/441))
Expand Down
52 changes: 24 additions & 28 deletions R/actionBttn.R
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#' @title Awesome action button
#'
#' @description Like \code{actionButton} but awesome, via \url{https://bttn.surge.sh/}
#' @description Like [shiny::actionButton()] but awesome, via \url{https://bttn.surge.sh/}
#'
#' @param inputId The \code{input} slot that will be used to access the value.
#' @param inputId The `input` slot that will be used to access the value.
#' @param label The contents of the button, usually a text label.
#' @param icon An optional icon to appear on the button.
#' @param style Style of the button, to choose between \code{simple}, \code{bordered},
#' \code{minimal}, \code{stretch}, \code{jelly}, \code{gradient}, \code{fill},
#' \code{material-circle}, \code{material-flat}, \code{pill}, \code{float}, \code{unite}.
#' @param color Color of the button : \code{default}, \code{primary}, \code{warning},
#' \code{danger}, \code{success}, \code{royal}.
#' @param size Size of the button : \code{xs},\code{sm}, \code{md}, \code{lg}.
#' @param style Style of the button, to choose between `simple`, `bordered`,
#' `minimal`, `stretch`, `jelly`, `gradient`, `fill`,
#' `material-circle`, `material-flat`, `pill`, `float`, `unite`.
#' @param color Color of the button : `default`, `primary`, `warning`,
#' `danger`, `success`, `royal`.
#' @param size Size of the button : `xs`,`sm`, `md`, `lg`.
#' @param block Logical, full width button.
#' @param no_outline Logical, don't show outline when navigating with
#' keyboard/interact using mouse or touch.
#'
#' @export
#'
#' @seealso \link{downloadBttn}
#' @seealso [downloadBttn()]
#'
#' @importFrom shiny restoreInput
#' @importFrom htmltools tags
Expand Down Expand Up @@ -97,21 +97,14 @@ actionBttn <- function(inputId,



#' Create a download \code{\link{actionBttn}}
#'
#' Create a download button with \link{actionBttn}.
#'
#' @param outputId The name of the output slot that the \code{downloadHandler} is assigned to.
#' @param label The label that should appear on the button.
#' @param style Style of the button, to choose between \code{simple}, \code{bordered},
#' \code{minimal}, \code{stretch}, \code{jelly}, \code{gradient}, \code{fill},
#' \code{material-circle}, \code{material-flat}, \code{pill}, \code{float}, \code{unite}.
#' @param color Color of the button : \code{default}, \code{primary}, \code{warning},
#' \code{danger}, \code{success}, \code{royal}.
#' @param size Size of the button : \code{xs},\code{sm}, \code{md}, \code{lg}.
#' @param block Logical, full width button.
#' @param no_outline Logical, don't show outline when navigating with
#' keyboard/interact using mouse or touch.
#' Create a download `actionBttn`
#'
#' Create a download button with [actionBttn()].
#'
#' @param outputId The name of the output slot that the [shiny::downloadHandler()] is assigned to.
#' @inheritParams actionBttn
#'
#' @seealso [actionBttn()]
#'
#' @export
#'
Expand Down Expand Up @@ -155,7 +148,8 @@ downloadBttn <- function(outputId,
color = "primary",
size = "md",
block = FALSE,
no_outline = TRUE) {
no_outline = TRUE,
icon = icon("download")) {
bttn <- actionBttn(
inputId = paste0(outputId, "_bttn"),
label = tagList(
Expand All @@ -168,10 +162,12 @@ downloadBttn <- function(outputId,
),
label
),
color = color, style = style,
size = size, block = block,
color = color,
style = style,
size = size,
block = block,
no_outline = no_outline,
icon = icon("download")
icon = icon
)
htmltools::tagAppendAttributes(
bttn,
Expand Down
4 changes: 2 additions & 2 deletions man/actionBttn.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions man/downloadBttn.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cf3ba12

Please sign in to comment.