将操作按钮与selectinput对齐,使其在光泽上水平

问题描述 投票:1回答:1
在我的闪亮仪表板上,我需要将actionButton与其他selectInput放在一个盒子中。以下是我的应用程序。 actionButton似乎与其他输入不太吻合。该按钮位于较高位置。我不明白为什么会这样。有人知道如何解决吗?

library(shiny) library(shinydashboard) ui <- dashboardPage( dashboardHeader(title = "example"), dashboardSidebar(), dashboardBody( box(width=12, column(width = 3, dateRangeInput("order_dash_dateRange", "Date Range", start = "2017-01-01", end = Sys.Date(), min = "2001-01-01", max = Sys.Date(), format = "mm/dd/yy", separator = " - ") ), column(width=3, selectizeInput(inputId = 'var', label='Select variable', choices = c('cut', 'color'), multiple=FALSE, options = list( maxItems = 1, placeholder = '', onInitialize = I("function() { this.setValue(''); }"))) ), column(width=3, uiOutput("valueUI")), column(width=3, actionButton('go', 'apply filter') ) ) ) ) server <- function(input, output, session) { output$valueUI = renderUI({ if (input$var == '') { vals = '' } if (input$var == 'cut') { vals = c('Premium', 'Good', 'Very Good', 'Fair') } if (input$var == 'color'){ vals = c('E', 'J', 'I', 'H') } selectizeInput(inputId = 'value', label='Select values', choices = vals, multiple=FALSE, options = list( maxItems = 1, placeholder = '', onInitialize = I("function() { this.setValue(''); }"))) }) } shinyApp(ui, server)

r shiny shinydashboard
1个回答
2
投票
enter image description here

您可以通过在actionButton中手动添加相同量(高度)的边距来解决它>

由于其他dateRangeInputselectizeInputuiOutput具有20px label,并且具有5px的边距作为图像。

在顶部加上25像素会很好地对齐actionButton

actionButton('go', 'apply filter', style = 'margin-top:25px')

© www.soinside.com 2019 - 2024. All rights reserved.