简体   繁体   中英

Using shinyWidgets for fileInput button

All of the buttons in a shiny app I am making use shinyWidgets . I also use a fileInput button and I would like the button of this to be in the same style as my shinyWidgets::actionBttn . Is there a way of doing this?

library(shiny)
library(shinyWidgets)

shinyUI(fluidPage(

  # Application title
  titlePanel("Uploac a file"),

  fileInput("Myfile",label="",multiple = FALSE),br(),
  actionBttn("textPrep",label = "Browse")
))

You can do something like this:

library(shiny)
library(shinyWidgets)
library(shinyjs)

ui <- fluidPage(
  useShinyjs(),

  # Application title
  titlePanel("Upload a file"),

  fileInput("Myfile", label="", multiple = FALSE), 
  br(),
  actionBttn("textPrep", label = "Browse")
)

server <- function(input, output){
  addCssClass(class = "bttn bttn-unite bttn-default bttn-no-outline", 
              selector = ".btn-file")
}

shinyApp(ui, server)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM