card {shidashi} | R Documentation |
Card-like 'HTML' element
Description
Card-like 'HTML' element
Usage
card(
title,
...,
footer = NULL,
tools = NULL,
inputId = NULL,
class = "",
class_header = "",
class_body = "",
class_foot = "",
style_header = NULL,
style_body = NULL,
start_collapsed = FALSE,
resizable = FALSE,
root_path = template_root()
)
card2(
title,
body_main,
body_side = NULL,
footer = NULL,
tools = NULL,
inputId = NULL,
class = "",
class_header = "",
class_body = "min-height-400",
class_foot = "",
style_header = NULL,
style_body = NULL,
start_collapsed = FALSE,
root_path = template_root()
)
card2_open(inputId, session = shiny::getDefaultReactiveDomain())
card2_close(inputId, session = shiny::getDefaultReactiveDomain())
card2_toggle(inputId, session = shiny::getDefaultReactiveDomain())
card_operate(
inputId,
title,
method,
session = shiny::getDefaultReactiveDomain()
)
Arguments
title |
the title of the card |
... |
the body content of the card |
footer |
the footer of the card; will be hidden if
|
tools |
a list of tools or badges to be displayed at
top-right corner, generated by |
inputId |
the id of the card |
class |
the 'HTML' class of the entire card |
class_header |
the the 'HTML' class of the card header |
class_body |
the the 'HTML' class of the card body |
class_foot |
the the 'HTML' class of the card footer |
style_header |
'CSS' style of the header |
style_body |
'CSS' style of the body |
start_collapsed |
whether the card starts as collapsed |
resizable |
whether the card body can be resized vertically; notice that if true, then the default padding for body will be zero |
root_path |
see |
body_main , body_side |
used by |
session |
shiny session domain |
method |
action to expand, minimize, or remove the cards;
choices are |
Value
'HTML' tags
Examples
library(shiny)
library(shidashi)
# Used for example only
ns <- I
session <- MockShinySession$new()
# -------------- Basic usage -------------
card(
title = "Badges", div(
class = "padding-20",
p(
"Add badges to the top-right corder. ",
"Use \"|\" to indicate the badge classes; ",
"for example: \"badge-info\", \"badge-warning\"..."
),
hr(), p(
"Use `resizable = TRUE` to make card resizable."
)
),
tools = list(
as_badge("New|badge-info"),
as_badge("3|badge-warning")
),
class_body = "height-300",
resizable = TRUE
)
# ---------------- With tools -----------------
card(
title = "Default Tools",
plotOutput(
ns("card_defaulttool_plot"),
height = "100%"
),
tools = list(
card_tool(
widget = "link",
href = "https://github.com/dipterix"
),
card_tool(widget = "collapse"),
card_tool(widget = "maximize")
),
class_body = "height-300",
resizable = TRUE
)
# -------------- Card2 example --------------
card2(
title = "Card2 Example", body_main =
plotOutput(
outputId = ns("card2_plot"),
height = "100%"
),
body_side = fluidRow(
column(
6L, textInput(
ns("card2_plot_title"),
"Plot title"
)
),
column(
6L, sliderInput(
ns("card2_plot_npts"),
"# of points", min = 1, max = 100,
value = 10, step = 1, round = TRUE
)
)
),
tools = list(
card_tool(widget = "link",
href = "https://github.com/dipterix"),
card_tool(widget = "collapse"),
card_tool(widget = "maximize")
),
class_body = "height-300"
)