The r2resize package provides a set of highly
customizable and resizable HTML containers for your R Markdown documents
and Shiny applications. This vignette will walk you through the usage of
splitCard, splitCard2,
sizeableCard, windowCard, and
empahsisCard.
splitCard(): Resizable Split Screen ContainerThe splitCard function creates a container with two
panels (left/right or top/bottom) and a draggable splitter.
# Basic vertical split card
splitCard(
"Content on the Left/Top",
"Content on the Right/Bottom"
)
# Customizing colors and position
splitCard(
"Left Panel Content",
"Right Panel Content",
bg.left.color = "lightblue",
bg.right.color = "lightgreen",
splitter.color = "darkgray",
position = "vertical",
min.height = "300px",
left.width = "60%"
)
# Horizontal split card
splitCard(
shiny::tags$h3("Header for Top Panel"),
shiny::tags$p("Some text for the bottom panel."),
bg.left.color = "#f0f0f0",
bg.right.color = "white",
position = "horizontal"
)splitCard2(): Alternative Split Screen ContainersplitCard2 offers another style of split screen
container, often useful for comparison or question-answer layouts.
# Simple splitCard2 with default styling
splitCard2(
shiny::tags$h2("Question Section"),
shiny::tags$p("This is where your question or main topic goes."),
slider.position = "30" # 30% for the left panel
)
# Customizing colors and text
splitCard2(
shiny::tags$h3("Code Snippet"),
shiny::tags$pre("print('Hello, r2resize!')"),
bg.left.color = "#e0e0e0",
bg.right.color = "white",
border.color = "blue",
text.left.color = "darkred",
text.right.color = "darkgreen",
slider.position = "50"
)sizeableCard(): Resizable Content HoldersizeableCard creates a container with a resizing
toolbar, allowing users to adjust its size.
windowCard(): Resizable, Moveable, Expandable Window
CardwindowCard creates a draggable and resizable window-like
container, great for pop-up information or interactive dashboards.
empahsisCard(): Emphasis ContainerempahsisCard creates a container with a moving border
effect to draw attention to its content.