Reputation: 860
The following dashboard page consists of action buttons aligned to the left and the plot and two more zoom and reset buttons. I want to position the box at the center of the screen and zoom and reset buttons to the extreme top-right. Rest all buttons are fine. I tried to use tags$div but no help. Please help and big thanks in advance.
## app.R ##
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "My Dashboard"),
dashboardSidebar(
width = 0
),
dashboardBody(
tags$br(actionButton("go", "Log")),
tags$br(),
tags$br(actionButton("go", "Case")),
tags$br(),
tags$br(actionButton("go", "Resource")),
tags$br(),
tags$br(actionButton("go", "Activity")),
tags$br(),
tags$br(actionButton("go", "Resource-activity")),
box(),
tags$br(actionButton("go", "Zoom")),
tags$br(actionButton("go", "Reset"))
))
server <- function(input, output)
{
}
shinyApp(ui, server)
Upvotes: 2
Views: 10517
Reputation: 29387
Something like this do?
## app.R ##
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "My Dashboard"),
dashboardSidebar(
width = 0
),
dashboardBody(
fluidRow(
column(1,
tags$br(actionButton("go", "Log")),
tags$br(),
tags$br(actionButton("go1", "Case")),
tags$br(),
tags$br(actionButton("go2", "Resource")),
tags$br(),
tags$br(actionButton("go3", "Activity")),
tags$br(),
tags$br(actionButton("go4", "Resource-activity"))),
br(),
column(10,
box(width=12,plotOutput("plot"))),
column(1,
tags$br(actionButton("go5", "Zoom")),
tags$br(),
tags$br(actionButton("go6", "Reset"))))
))
server <- function(input, output){
output$plot <- renderPlot(hist(mtcars$disp))
}
shinyApp(ui, server)
Upvotes: 2
Reputation: 525
You could play with fluidRow
and column
:
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "My Dashboard"),
dashboardSidebar(
width = 0
),
dashboardBody(
fluidRow(
column(2, offset = 1,
actionButton("go", "Log")
),
column(2, offset = 7,
actionButton("go", "Zoom")
)
),
fluidRow(
column(2, offset = 1,
actionButton("go", "Case")
),
column(2, offset = 7,
actionButton("go", "Reset")
)
),
fluidRow(
column(2, offset = 1,
actionButton("go", "Resource")
),
column(8, offset = 1,
box()
)
),
fluidRow(
column(2, offset = 1,
actionButton("go", "Activity")
)
),
fluidRow(
column(2, offset = 1,
actionButton("go", "Resource-activity")
)
)
)
)
server <- function(input, output) {}
shinyApp(ui, server)
But there might be better alternatives.
Upvotes: 2