#' @title
#' Bulma Tag
#'
#' @description
#' Small tag labels to insert anywhere. The Bulma tag is a small but versatile
#' element. It's very useful as a way to attach information to a block or other
#' component. Its size makes it also easy to display in numbers, making it
#' appropriate for long lists of items.
#'
#' [Documentation](https://bulma.io/documentation/elements/tag/)
#'
#' @family Bulma Elements
#' @name bulma_tag
NULL
#' @describeIn bulma_tag is a single tag.
#'
#' @param color (string) color of the tag.
#' @param size (string) size of the tag
#' @param light (flag) whether or not the color is light
#' @param rounded (flag) rounded tag
#' @param delete (flag) delete button
#' @param tag (tag) html tag (`<span>` for tag, `<div>` for tags)
#' @param ... (tag) content
#'
#' @export
bulma_tag <- function(...,
color = c("primary", "link", "info",
"success", "warning", "danger",
"white", "black", "light", "dark"),
size = c("small", "medium", "large", "normal"),
light = FALSE,
rounded = FALSE,
delete = FALSE,
tag = tags$span) {
assert_function(tag)
assert_flag(light)
tag(class = "tag", ...) %>%
bulma_color(color) %>%
bulma_size(size) %>%
when(light, bulma_is(., "light")) %>%
when(rounded, bulma_rounded(.)) %>%
when(delete, bulma_is(., "delete")) %>%
add_class("bulma_tag")
}
#' @describeIn bulma_tag a container for various tags.
#'
#' @param attach (flag) merge tags together.
#'
#' @export
bulma_tags <- function(...,
size = c("small", "medium", "large"),
attach = FALSE,
tag = tags$div) {
walk(unnamed(...), assert_class, "bulma_tag")
size <- match_arg(size)
tag(class = "tags", ...) %>%
when(attach, bulma_has(., "addons")) %>%
bulma_are(size) %>%
add_class("bulma_tags")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.