rstudio / shinydashboard

Shiny Dashboarding framework
https://rstudio.github.io/shinydashboard/
Other
885 stars 300 forks source link

When changing the button theme, its color is still gray / black. #374

Closed simon7073 closed 10 months ago

simon7073 commented 2 years ago

When I create a button with another theme, such as the primary button, I get the button in black font instead of white. image my code like this:


library(shiny)
Welcome_ui = function(id) {
  ns = NS(id)
  htmltools::tagList(
    fluidRow(column(12, 
                    actionButton("id1", "Confirm", class = "btn-primary"),
                    actionButton("id2", "Go!", class = "btn-success")
    ))
  )
}

main_UI = function() {
  # header ----
  dashboard.header = shinydashboard::dashboardHeader()

  # sidebar ----
  dashboard.sidebar = shinydashboard::dashboardSidebar(
    shinydashboard::sidebarMenu(
      shinydashboard::menuItem("Welcome", tabName = "welcome", icon = icon("star"))
    )
  )

  # body ----
  dashboard.body = shinydashboard::dashboardBody(
    shinydashboard::tabItems(
      shinydashboard::tabItem(tabName = "welcome", Welcome_ui("Welcome"))
    )
  )

  # dashboardPage ----
  shinydashboard::dashboardPage(
    header = dashboard.header,
    body = dashboard.body,
    sidebar = dashboard.sidebar
  )
}

main_Server = function() {function(input, output, session) {}}

shinyApp(ui = main_UI(), server = main_Server())

Although it can be solved by adding styles, this does not solve fundamental problems.

The reason for the problem is that the actionButton and AdminLTE frameworks are not well compatible. In function actionButton , class btn-primary will overwrites btn-default,So shiny didn't deletebtn-default.

But the other themes of the buttons inside AdminLTE do not have the font color attribute, so the font color is still the color of btn-default.


Em... : Shinydashboard (0.7.1) uses the AdminLTE framework (v2.3.11), but the path is shown as 2.0.6, and the latest version is 3.1.0.

YongbingDing commented 10 months ago

您好,丁永兵已经收到您的邮件,谢谢。