【发布时间】:2020-08-08 07:34:50
【问题描述】:
我有一个示例闪亮的应用程序,如下所示。为了使用 selectInput 的 actionButton,我需要添加 style='margin-top:25px'。 Shinywidgets 包有 actionBttn 带有一些内置样式的小部件。例如,我喜欢带有style='gradient' 的那个。但我想知道如何使用 css 样式在顶部添加边距以将 actionBttn 与其他元素对齐?
library(shiny)
library(shinydashboard)
library(shinyWidgets)
ui <- dashboardPage(
dashboardHeader(title = "example"),
dashboardSidebar(),
dashboardBody(
box(width=12,
column(width = 3, dateRangeInput("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=1, offset =2, actionButton('Apply', 'Apply', style='margin-top:25px') ),
column(width=3, actionBttn(
inputId = 'clear',
label = "Clear",
style = "gradient",
color = "danger" ) )
)
)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
【问题讨论】:
标签: css r shiny shinydashboard shinywidgets