spsTitle: Colorful title element

Description Usage Arguments Value Examples

View source: R/bs_components.R

Description

Add a title element to UI

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
spsTitle(
  title,
  level = "2",
  status = "info",
  other_color = NULL,
  opacity = 1,
  ...
)

tabTitle(
  title,
  level = "2",
  status = "info",
  other_color = NULL,
  opacity = 1,
  ...
)

Arguments

title

string, title text

level

string, level of the title, the larger, the bigger, one of "1", "2", "3", "4", "5", "6"

status

string, one of "primary", "info", "success", "warning", "danger". This determines the color of the line.

other_color

string, if you do not like the default 5 status colors, specify a valid CSS color here. If this is provided, status will be ignored.

opacity

numeric, a number larger than 0 smaller than 1

...

other attributes and children add to this element

Value

returns a shiny tag

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
if(interactive()) {
  library(shiny)
  library(magrittr)
  ui <- fluidPage(
    tags$b("Different status"),
    c("primary", "info", "success", "warning", "danger") %>%
      lapply(function(x) spsTitle(x, "4", status = x)),
    tags$b("custom color"),
    spsTitle("purple", "4", other_color = "purple"),
    spsTitle("pink", "4", other_color = "pink"),
    tags$b("Different levels"),
    lapply(as.character(1:6), function(x) spsTitle(paste0("H", x), x)),
    tags$b("Different opacity"),
    lapply(seq(0.2, 1, 0.2), function(x) spsTitle(as.character(x), opacity = x))
  )
  server <- function(input, output, session) {}
  shinyApp(ui, server)
}

spsComps documentation built on Feb. 3, 2022, 1:07 a.m.