html - R Shiny - 垂直对齐标签并以水平形式输入
问题描述
我正在尝试以水平形式垂直对齐输入及其标签。我不确定是否可以垂直对齐不同高度的内联 div。
下面的代码给了我以下信息:
我希望标签与输入保持一致。
library(shiny)
library(shinyWidgets)
library(shinydashboard)
ui <- fluidPage(
column(width = 8,
tabBox(width = 12,
tabPanel(
'Items',
fluidRow(
style = 'margin:2px',
wellPanel(
tags$form(class = 'form-horizontal',
tags$b('Filter items'),
tags$div(
class = 'form-group',
tags$label(class = "col-sm-3 control-label", `for` = 'type', "By type:"),
column(
width = 9,
pickerInput(
inputId = 'type', label = '',
choices = character(0),
multiple = T
))),
tags$div(
class = 'form-group',
tags$label(class = "col-sm-3 control-label", `for` = 'name', "By name:"),
column(
width = 9,
searchInput(
inputId = 'name', label = '',
placeholder = "Search by name",
btnSearch = icon("search"),
btnReset = icon("remove")
))
)
)
)
)
)
)
) #/column 8
)
server <- function(input, output, session) {}
shinyApp(ui, server)
我还尝试过什么column(width = 3, ...)
:
- 柔性:
tags$div(class = 'form-group', style = 'display:flex; align-items:center;', ...)
- 职位:
tags$div(class = 'form-group', style = 'display:table; position:absolute;', tags$label(class = "col-sm-3 control-label", style = 'display;table-cell; vertical-align:middle;', ...), ...)
。
我不精通 HTML,所以需要大量猜测。达到预期结果的最佳方法是什么?任何帮助将不胜感激。
解决方案
也许只需将选项卡面板排列成多行,并在其中排列您喜欢的列。
#
#
library(shinydashboard)
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
tabBox(
tabPanel(title = "Items",
wellPanel(
fluidRow(column(width = 12,"Filter Items")),
br(),
fluidRow(
column(width = 3,"By Type: "),
column(width = 9,
pickerInput(inputId = "choices.type",
choices = character(0),
multiple = TRUE))
),
fluidRow(
column(width = 3,"By Name: "),
column(width = 9,
searchInput(inputId = "seach.name",
placeholder = "Search",
btnSearch = icon("search"),
btnReset = icon("remove")))
)
)
)
)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
推荐阅读
- python - 哪个 Pandas 数据框更好:超长数据框 VS 结构不良的带有列表的数据框
- python - 如何在python代码中获取mnist数据集的错误接受率和错误拒绝率之间的图表
- typescript - 条件类型添加一个额外的泛型得到编译器错误
- php - 有什么具体的方法来编写 click house curl 插入查询吗?
- c - C中的单指针与双指针
- python - 如何使用 df.iterrows() 匹配同一列中的前一行值?
- rust - 请求的 Rust-rocket 匹配花费了很长时间(5 分钟)
- android - 在 Android Studio 的 build.gradle 中设置的 Android R/11 的 API 级别是什么?
- c# - C#:从集合中提取数据并将其存储在数组中
- ubuntu-18.04 - 在 ubuntu 18.04 中安装画面