#' @title
#' Bulma Level
#'
#' @description
#' A multi-purpose horizontal level, which can contain almost any other element.
#' All the elements of this level are in the same vertical position.
#'
#' * `bulma_level()` - main container
#' * `bulma_level_right()` - right section of level
#' * `bulma_level_left()` - left section of level
#' * `bulma_level_item()` - item inside the right or left sections, but if
#' directly under the main container, then centered.
#'
#' [Level](https://bulma.io/documentation/layout/level/)
#'
#' @family Bulma Layouts
#' @name bulma_level
NULL
#' @describeIn bulma_level main container; needs to contain
#' `bulma_level_right()`, `bulma_level_left()`, `bulma_level_item()`.
#'
#' @param ... (tags) content
#' @param tag (fn) default HTML content
#' @param mobile (flag) the level is vertical on mobile unless this is TRUE.
#'
#' @export
bulma_level <- function(..., mobile = FALSE, tag = tags$div) {
assert_function(tag)
walk(tagList(...), assert_multi_class, c("bulma_level_right",
"bulma_level_left",
"bulma_level_item"))
tag(class = "level", ...) %>%
when(mobile, bulma_is(., "mobile")) %>%
add_class("bulma_level")
}
#' @describeIn bulma_level right aligned section of level
#' @export
bulma_level_right <- function(..., tag = tags$div) {
assert_function(tag)
walk(tagList(...), assert_class, "bulma_level_item")
tag(class = "level-right", ...) %>%
add_class("bulma_level_right")
}
#' @describeIn bulma_level left aligned section of level
#' @export
bulma_level_left <- function(..., tag = tags$div) {
assert_function(tag)
walk(unnamed(...), assert_class, "bulma_level_item")
tag(class = "level-left", ...) %>%
add_class("bulma_level_left")
}
#' @describeIn bulma_level bulma item; under the left, right, or directly
#' under the level
#' @export
bulma_level_item <- function(..., tag = tags$div) {
assert_function(tag)
tag(class = "level-item", ...) %>%
add_class("bulma_level_item")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.