【问题标题】:Background color in tabsetPanel in Shiny闪亮的tabsetPanel中的背景颜色
【发布时间】:2014-08-18 23:53:57
【问题描述】:

如何在tabsetPanel 中获得白色背景。为了更好地理解我的问题,我将举一个例子:

在我的 ui.R 文件中,我有以下内容:

mainPanel( wellPanel(wellPanel(plotOutput("densityPlot", height="500px"))), 
                               wellPanel(tabsetPanel(type = "tabs", 

        tabPanel(h5("Text1"),p("Text" )),
        tabPanel(h5("Text2"), p("Text") ),                   
        tabPanel(h5("Text3"), p("Text"))),
        br(),
        br(),
        br()                           
    ))

为了更清楚,请看下面的图片:

不同之处在于任何 tagPanel 内部的白色背景区域。这种灰色和白色的组合就是问题所在。有谁知道,我怎么能得到这样的tagPanals。

【问题讨论】:

    标签: css r shiny


    【解决方案1】:

    wellPanel 上使用style 选项:

    runApp(list(
      ui = fluidPage(
        titlePanel("Hello Shiny!"),
        sidebarLayout(
          sidebarPanel(
            numericInput('n', 'Number of obs', 100)
          ),
          mainPanel( wellPanel(wellPanel(plotOutput("densityPlot", height="500px"))), 
                     wellPanel(style = "background-color: #ffffff;", tabsetPanel(type = "tabs", 
    
                                           tabPanel(h5("Text1"),p("Text" )),
                                           tabPanel(h5("Text2"), p("Text") ),                   
                                           tabPanel(h5("Text3"), p("Text"))),
                               br(),br(),br()                           
                     ))
        )
      )
      ,
      server = function(input, output) {
        output$densityPlot <- renderPlot({ hist(runif(input$n)) })
      }
    ))
    

    【讨论】:

    • 是否可以控制任何 tabPanal 的背景颜色,例如第一个是白色,第二个是灰色,第三个是浅蓝色?在这种情况下,它们都具有相同的颜色。并且首选点击Text1,所以另一个必须是灰色而不是白色,就像我上传的图片一样。
    • 知道如何实现这种风格吗?
    • @您应该考虑为此提出一个单独的问题
    猜你喜欢
    • 2016-02-18
    • 2016-05-03
    • 2018-07-14
    • 2021-11-15
    • 1970-01-01
    • 1970-01-01
    • 2016-01-15
    • 2021-08-29
    • 2018-10-22
    相关资源
    最近更新 更多