问题
I am trying to build an app using R shiny where I am using fileinput and action button in same box. I am facing issues to show above two inline. Refer to below working example:
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "Inline Widgets Issue"),
dashboardSidebar(
),
dashboardBody(
box(title = "Working Example",width=40 ,status = "warning", solidHeader = TRUE, collapsible = FALSE,
fluidRow(column(width=8,fileInput('file1', 'Browse File',width="100%",
accept=c('text/csv', 'text/comma-separated-values,text/plain', '.csv'))),
column(width=2,actionButton("save","Save!!")))
))
)
server <- function(input, output) {
}
shinyApp(ui, server)
Currently this is the situation:
I want something like this:回答1:
You could add a style tag to your action button:
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "Inline Widgets Issue"),
dashboardSidebar(
),
dashboardBody(
box(title = "Working Example",width=40 ,status = "warning", solidHeader = TRUE, collapsible = FALSE,
fluidRow(column(width=8,fileInput('file1', 'Browse File',width="100%",
accept=c('text/csv', 'text/comma-separated-values,text/plain', '.csv'))),
column(width=2,actionButton("save","Save!!"))),
tags$style(type='text/css', "#save { width:100%; margin-top: 25px;}")
))
)
server <- function(input, output) {
}
shinyApp(ui, server)
you can also play around with width and margin-top to change the size and position of the action button.
来源:https://stackoverflow.com/questions/50532088/to-show-fileinput-and-actionbutton-inline