#' @title
#' Bulma Columns
#'
#' @description
#' The power or flexbox in a simple interface.
#'
#' [Columns](https://bulma.io/documentation/columns/)
#'
#' @param ... (tags) content
#' @param tag (fn) default HTML tag
#'
#' @family Bulma Layouts
#' @name bulma_column
NULL
#' @describeIn bulma_column standard column; very flexible interface
#' @param size (string) a particular size of the maximum horizontal width
#' @param breakpoint (string) bulma column
#' @param multiline (flag) multiline column
#' @param centered (flag) horizontally centered
#' @param vcentered (flag) vertically centered
bulma_column <- function(...,
size = c("three-quarters",
"two-thirds",
"half",
"one-third",
"one-quarter",
"full",
"four-fifths",
"three-fifths",
"two-fifths",
"one-fifth",
1:12),
breakpoint = c("mobile",
"tablet",
"touch",
"desktop",
"widescreen",
"fullhd"),
multiline = FALSE,
centered = FALSE,
vcentered = FALSE,
tag = tags$div) {
breakpoint <- match_arg(breakpoint)
size <- match_arg(size)
assert_true(is.null(breakpoint) || !is.null(size))
tag(
class = "column",
...
) %>%
when(!is.null(size) & is.null(breakpoint),
bulma_is(., size)) %>%
when(!is.null(size) & !is.null(breakpoint),
bulma_is(., glue("{size}-{breakpoint}"))) %>%
add_class("bulma_column")
}
#' @describeIn bulma_column a set of columns
#' @param gap (int) size of the gap
#' @param gapless (flag) no gap; same as `gap = 0`
#' @param multiline (flag) columns can wrap
#' @export
bulma_columns <- function(...,
gap = 0:8,
gapless = FALSE,
multiline = FALSE,
tag = tags$div) {
gap <- as.character(match_arg(gap))
walk(tagList(...), ~assert_class(., "bulma_column"))
assert_flag(gapless)
assert_flag(multiline)
assert_function(tag)
assert_true(is.null(gap) || !gapless)
tag(
class = "columns",
...
) %>%
when(gapless, bulma_is(., "gapless")) %>%
when(multiline, bulma_is(., "multiline")) %>%
when(!is.null(gap), bulma_is(bulma_is(., "variable"), gap)) %>%
add_class("bulma_columns")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.