#' @title
#' Bulma Image
#'
#' @description
#' A container for responsive images. Because images can take a few seconds to
#' load (or not at all), use the image container to specify a precisely sized
#' container so that your layout isn't broken because of image loading or image
#' errors.
#'
#' [Image](https://bulma.io/documentation/elements/image/)
#'
#' @family Bulma Elements
#' @name bulma_image
NULL
#' @describeIn bulma_image image container
#'
#' @param ... (tags) content
#' @param tag (fn) default HTML tag container
#' @param square (int) if this is a fixed size square container, the size of the
#' container; useful for avatars
#' @param ratio (string) the responsive ratio of the image
#' @param fig_tags (tags) tags that are inside the `<figure>` tag.
#' @param rounded,full_width (flag) style parameters
#'
#' @export
bulma_image <- function(...,
square = c(16L, 24L, 32L, 48L, 64L, 96L, 128L),
ratio = c("square", "1by1", "5by4", "4by3", "3by2",
"5by3", "16by9", "2by1", "3by1", "4by5",
"3by4", "2by3", "3by5", "9by16", "1by2",
"1by3"),
fig_tags = list(),
rounded = FALSE,
full_width = TRUE,
tag = tags$img) {
square <- match_arg(square)
ratio <- match_arg(ratio)
assert_true(is.null(ratio) || is.null(square))
assert_flag(rounded)
assert_flag(full_width)
exec(
tags$figure,
class = "image",
tag(...) %>%
when(!identical(tags$img, tag), bulma_has(., "ratio")) %>%
when(rounded, bulma_is(., "rounded")),
!!!fig_tags
) %>%
when(full_width, bulma_fullwidth(.)) %>%
when(!is.null(square), bulma_is(., glue("{square}x{square}"))) %>%
when(!is.null(ratio), bulma_is(., ratio)) %>%
add_class("bulma_image")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.