Reputation: 399
Is it possible to have columns within a box in the UI? I have several inputs and I want all of them to be in a box but side by side (and not in separate row for each input).
Upvotes: 1
Views: 4057
Reputation: 7694
Yes it is possible to have columns within a box in the UI.
You can have a look at the following code:
library("shinydashboard")
body <- dashboardBody(
box(title = "Box",
width = 12,
status = "warning",
solidHeader = TRUE,
collapsible = TRUE,
column(width = 6, plotOutput(outputId = "Plot1")),
column(width = 6, plotOutput(outputId = "Plot2"))
)
)
server <- function(input, output) {
output$Plot1 <- renderPlot({
plot(rnorm(10))
})
output$Plot2 <- renderPlot({
plot(rnorm(20))
})
}
shinyApp(
ui = dashboardPage(
dashboardHeader(),
dashboardSidebar(),
body
),
server = server
)
Upvotes: 4