闪亮调整按钮位置在侧栏中

时间:2017-05-09 14:41:29

标签: r shiny

我正在使用Shiny Dashboard来尝试学习它

我创建了下面的脚本(因保密而删除了某些内容),它提供了选择标准日期,国家/地区和一个带有下载按钮的流程按钮

不幸的是,进程按钮实际上并不在其他对象的下方。有没有一种方法可以将处理按钮向右推几个像素?

library(shinydashboard)
header <- dashboardHeader(title = "Some Header")

sidebar <- dashboardSidebar(br(),title = "Selection Options",
                        uiOutput("choose_daterange"),
                        uiOutput("choose_ctry"),
                        br(),
                        actionButton("run_report", "Process", icon =    icon("refresh")),
                        actionButton("download", "Download", icon = icon("download"))
) 



body <- dashboardBody("Hello World")


# Pulling it all together
dashboardPage(
 skin = "yellow",
  header,
  sidebar,
  body
)  

1 个答案:

答案 0 :(得分:2)

尝试在代码中添加html样式标记:

sidebar <- dashboardSidebar(br(),title = "Selection Options",
                            uiOutput("choose_daterange"),
                            uiOutput("choose_ctry"),
                            br(),
                            actionButton("run_report", "Process", icon = icon("refresh")),
                            actionButton("download", "Download", icon = icon("download")),
                            tags$style(type='text/css', "#run_report { width:50%; margin-left: 5px;}")

) 

您可以调整宽度以确保按钮的长度/宽度相等