#' @title
#' Bulma Title
#'
#' @description
#' Simple headings to add depth to your page. When you combine a title and a
#' subtitle, they move closer together. As a rule of thumb, it is recommended
#' to use a size difference of two.
#'
#' [Documentation](https://bulma.io/documentation/elements/title/)
#'
#' @param ... (tag) content
#' @param size (int) different text sizes from 1 to 6.
#' @param spaced (flg) whether or not the title and subtitle will have a space
#' in between them; no spacing by default.
#'
#' @family Bulma Elements
#' @name bulma_title
NULL
#' @describeIn bulma_title title element, default size is `3L`
#' @export
bulma_title <- function(..., size = 1L:6L, spaced = FALSE) {
size <- as.character(match_arg(size) %||% 3L)
htmltools::tag(
`_tag_name` = glue("h{size}"),
varArgs = list(
class = "title",
...
)
) %>%
bulma_is(glue("size-{size}")) %>%
when(spaced, bulma_is(., "spaced")) %>%
add_class("bulma_title")
}
#' @describeIn bulma_title subtitle element, default size is `5L`.
#' @export
bulma_subtitle <- function(..., size = 1L:6L) {
size <- as.character(match_arg(size) %||% 5L)
htmltools::tag(
`_tag_name` = glue("h{size}"),
varArgs = list(
class = "subtitle",
...
)
) %>%
bulma_is(glue("size-{size}")) %>%
add_class("bulma_subtitle")
}
#' @describeIn bulma_title heading element
#' @export
bulma_heading <- function(...) {
tags$p(class = "heading", ...) %>%
add_class("bulma_heading")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.