【问题标题】:Placing two actions buttons beside each other in a shiny app在闪亮的应用程序中将两个操作按钮并排放置
【发布时间】:2017-12-12 22:46:54
【问题描述】:

我正在尝试在侧边栏中的 Shiny 应用中放置两个操作按钮。这是可能吗?如果我可以保持简单,我不想求助于使用列

ui.R:
fluidPage(
 # Application title
 titlePanel("Place Two Buttons"),

 sidebarLayout(
# Sidebar with a slider and selection inputs
sidebarPanel(

  actionButton("read", "Change"),
  hr(),
  actionButton("write", "Change") 
),


mainPanel(
  plotOutput("plot")
  )
)
)

和我的服务器:

server.R:
function(input, output, session) {

}

到目前为止,我发现的所有内容都是使用 css 表达式或使用 Bootstrappage。有什么帮助吗?

【问题讨论】:

标签: css r shiny


【解决方案1】:

您可以删除hr() 以使两个按钮并排:

ui <- fluidPage(
  # Application title
  titlePanel("Place Two Buttons"),

  sidebarLayout(
    # Sidebar with a slider and selection inputs
    sidebarPanel(
      actionButton("read", "Change"),
      actionButton("write", "Change") 
    ),

    mainPanel(
      plotOutput("plot")
    )
  )
)

server <- function(input, output, session) {}
shinyApp( ui = ui, server = server )

这给出了这个:

【讨论】:

  • Mike H:我的意思是把两个按钮放在一起,而不是放在一起。这可能吗?
  • @owise,为什么不干脆去掉hr() 函数?
  • @owise - 已更新。不知道能不能把空间变小,不过大概可以加一些空白的UI来增加空间。不幸的是,HTML 没有“垂直规则”。
  • 它工作得很好,但是当我添加这个表达式时,它不起作用:` withBusyIndi​​catorUI(actionButton("read", "Change!", class= "btn-primary")), withBusyIndi​​catorUI(actionButton("write", "Change!", class= "btn-primary"))`
  • @owise 嗯,对我来说很好用。如果您使用可重复的示例提出新问题,这可能会有所帮助
猜你喜欢
  • 2020-12-28
  • 1970-01-01
  • 2019-05-02
  • 2023-04-09
  • 2020-05-21
  • 2019-07-15
  • 2020-09-05
  • 2014-08-07
  • 1970-01-01
相关资源
最近更新 更多