#' @title
#' Bulma Tile
#'
#' @description
#' A single tile element to build 2-dimensional Metro-like, Pinterest-like, or
#' whatever-you-like grids.
#'
#' * Start with an ancestor tile that will wrap all other tiles.
#' * Add tile elements that will distribute themselves horizontally.
#' * You can resize any tile horizontally according to a 12 column grid.
#' * You can switch it vertically.
#' * If you want it to contain something, make it a parent and add a child tile.
#'
#' [Documentation](https://bulma.io/documentation/layout/tiles/)
#'
#' @param ... content
#'
#' @family Bulma Layouts
#' @name bulma_tile
NULL
#' @describeIn bulma_tile default tile container
#' @param vertical (flag) arrange the contents as vertical
#' @param size (int) horizontal size from `1L` to `12L`.
#' @param role (string) what role this tile plays
#' @param tag (tag) tag function (`<div>`)
#' @export
bulma_tile <- function(...,
vertical = FALSE,
size = 1:12,
role = c("ancestor", "parent", "child"),
tag = tags$div) {
assert_function(tag)
role <- match_arg(role)
size <- match_arg(size)
tag(class = "tile", ...) %>%
bulma_is(role) %>%
bulma_is(size) %>%
when(vertical, bulma_is(., "vertical")) %>%
add_class("bulma_tile")
}
#' @describeIn bulma_tile Ancestor tile
#' @export
bulma_tile_ancestor <- function(...,
vertical = FALSE,
size = 1:12,
tag = tags$div) {
bulma_tile(
role = "ancestor",
...,
vertical = vertical,
size = size,
tag = tag
)
}
#' @describeIn bulma_tile Parent tile
#' @export
bulma_tile_parent <- function(...,
vertical = FALSE,
size = 1:12,
tag = tags$div) {
bulma_tile(
role = "parent",
...,
vertical = vertical,
size = size,
tag = tag
)
}
#' @describeIn bulma_tile Child tile
#' @export
bulma_tile_child <- function(...,
vertical = FALSE,
size = 1:12,
tag = tags$div) {
bulma_tile(
role = "child",
...,
vertical = vertical,
size = size,
tag = tag
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.