我有一个非常基本的闪亮仪表板,我想将此actionbutton
的位置恰好设置在侧边栏的中间。它与侧边栏两侧的距离必须完全相同。
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(
title="Select Data to View or Download",
titleWidth = 335),
dashboardSidebar(
width = 335,
actionButton("load","Apply Selections")),
dashboardBody()
)
server <- function(input, output) { }
shinyApp(ui, server)
答案 0 :(得分:1)
一种更简单的方法(居中且无偏移)是使用style
参数设置按钮位置。
actionButton("load", "Apply Selections", style='margin:auto')
答案 1 :(得分:0)
这可以通过将其放入column
并设置align = "center"
来完成。
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(
title="Select Data to View or Download",
titleWidth = 335),
dashboardSidebar(
width = 335,
column(12,align = "center",offset = 0,actionButton("load","Apply Selections"))),
dashboardBody()
)
server <- function(input, output) { }
shinyApp(ui, server)