I want to create a wellPanel
to hold some inputs in a shiny
app. The code below reproduces what I'm trying to do. However, I want Section 2
to be right next to Section 1
and not on the opposite side of the well (see screenshot).
我想创建一个Well Panel,在一个闪亮的应用程序中保存一些输入。下面的代码重现了我正在尝试做的事情。但是,我希望2号井段紧挨着1号井段,而不是在井的对面(见截图)。
How can I achieve this? See reprex below.
我怎样才能做到这一点呢?请参见下面的reprex。
library(shiny)
ui <- fluidPage(
# Application title
titlePanel("Basic Shiny App"),
# Sidebar layout with input and output definitions
fluidRow(
column(
width = 10, offset = 1,
wellPanel(
div(actionButton("toggle", "Toggle")),
hr(),
div(
id = "some_id",
div(
style = "display: flex; justify-content: space-between;",
div(
style = "flex: 0.2; padding: 5px; background-color: wheat;",
div(
p("Section 1"),
actionButton("id", "Action 1")
)
),
div(
style = "flex: 0.2; padding: 5px; background-color: pink;",
class = "pull-left",
div(
p("Sectino 2"),
actionButton("ids", "Action 2")
)
)
)
)
)
)
)
)
server <- function(input, output) {
}
shinyApp(ui = ui, server = server)
I also noticed that columns don't work well inside well panels. Especially if I plan to toggle the input section of the wellpanel.
我还注意到,在井板内,柱子不能很好地工作。尤其是当我计划切换井板的输入部分时。
更多回答
Maybe I don't get the question right, but why are you using justify-content: space-between
? It's the reason why section 2 appears on the right hand side of the panel, in particular you can delete it and section 2 will appear next to section 1.
也许我没有正确回答这个问题,但是为什么要在两个单词之间使用JUSTIFY-CONTENT:空格呢?这就是第二节出现在面板右侧的原因,特别是你可以删除它,第二节将出现在第一节旁边。
@Jan Your suggestion worked. I had googled the code and didn't really understand what the justify-content: space-between
was doing.
@Jan你的建议奏效了。我在谷歌上搜索了代码,但并不真正理解JUSTY-CONTENTS:空格之间在做什么。
我是一名优秀的程序员,十分优秀!