闪亮的R对齐按钮

问题描述 投票:3回答:2

我的U.i文件中有两个按钮

div(style="display:inline-block",submitButton("Analysis")),
  div(style="display:inline-block",downloadButton('downloadData', 'Download Data'))

这在应用程序中提供以下输出

但是我正在尝试对齐这些按钮,以便下载数据位于灰色框的右侧,分析按钮位于灰色框的左侧,而不是现在的样子。我该怎么做?预期用途是变得更先进并创建另一个位于灰色框中间的按钮。我假设你做了类似的事情

style="display:center-align"
style="display:right-align"
style="display:left-align"

但我不确定如何进行这个过程。

r button alignment shiny
2个回答
7
投票

这有效:

div(style="display:inline-block",submitButton("Analysis"), style="float:right"),
div(style="display:inline-block",downloadButton('downloadData', 'Download Data'), style="float:right")

但是你应该考虑使用样式表,就像在这个答案中解释的那样:https://stackoverflow.com/a/25390164/1117932


0
投票

你应该尝试使用fluidRow()

#example
library(shiny)

ui <- fluidPage(
  fluidRow(
    actionButton(inputId = "button01", label = "A"),
    actionButton(inputId = "button02", label = "B"),
    actionButton(inputId = "button03", label = "C")
  )
)

server <- function(input, output, session){}
shinyApp(ui, server)
© www.soinside.com 2019 - 2024. All rights reserved.