if (interactive()) {
library(shiny)
# Basic vertical split card with default settings
shinyApp(
ui = fluidPage(
h2("Basic Split Card"),
splitCard(
shiny::div(h3("Left Panel"), p("Content for the left side.")),
shiny::div(h3("Right Panel"), p("Content for the right side."))
)
),
server = function(input, output) {}
)
# Horizontal split card with custom colors and minimum height
shinyApp(
ui = fluidPage(
h2("Horizontal Split Card with Custom Styling"),
splitCard(
shiny::div(h3("Top Panel (Blue)"), p("Content for the top section.")),
shiny::div(h3("Bottom Panel (Green)"), p("Content for the bottom section.")),
bg.left.color = "#E0F2F7",
bg.right.color = "#E8F5E9",
splitter.color = "#7CB342",
position = "horizontal",
min.height = "300px",
border.color = "#4CAF50"
)
),
server = function(input, output) {}
)
# Vertical split card with background images and specific widths
shinyApp(
ui = fluidPage(
h2("Split Card with Background Images"),
splitCard(
shiny::div(h3("Image Background Left"), p("Some text over an image.")),
shiny::div(h3("Image Background Right"), p("More text over another image.")),
left.bg.url = "https://r2resize.obi.obianom.com/m/image1.jpg",
right.bg.url = "https://r2resize.obi.obianom.com/m/image2.jpg",
text.left.color = "white",
text.right.color = "black",
left.width = "30%",
min.height = "450px"
)
),
server = function(input, output) {}
)
}
Run the code above in your browser using DataLab