R闪亮.流畅的定制

问题描述 投票:0回答:1

使用shiny.flutter作为框架构建应用程序,但不知道如何更改卡片颜色。由于它覆盖了引导程序,我正在开发自定义卡片功能,并尝试了内联和外部 css 来更改其颜色。

我尝试放入自定义函数,尝试在主 UI 中引用卡片中的类样式,尝试使用 div 将输出包装在服务器部分中,并按照以下方式指定内联 css 在此输入链接描述

我已遵循所有在线教程,但没有一个接近自定义卡片或 GridItem。

以下是我尝试过的各种方法:

在服务器端:

  # create a reactive to sum totals and return for range within chosen dates
  output$total <- renderText({
    div(
      class = "ms-fontWeight-bold bg-primary",
      data <- data(),
      sum <- data %>% group_by('Total Generation') %>% 
        summarise(Sum_Total_Gen = sum('Total Generation'))

在 UI 内联:

    GridItem(class = "bg-primary ms-sm12 ms-xl4",
         Card(title = "Date Filter", filters(),
              div()
         )

或者...

ui <- fluentPage(
  tag$style(
    div{
      color:red;
    }
  ),
  Grid(

在 UI 中链接 www 文件夹中的外部样式表(如文档中指定)

ui <- fluentPage(
  tags$head(
    tags$link(rel = "stylesheet", type = "text/css", href = "styles.css")
  ),
  Grid(
    GridItem(class = "ms-sm12 ms-xl8",

自定义卡片功能中:

Card <- function(..., title = NULL){
  Stack(
    class = "ms-depth-6",
    style = "color:red;",
    tokens = list(padding = 10,childrenGap = 10),
    if(!is.null(title)) Text(title, variant= "medium"),...
  )
}

流畅的用户界面新手,但也很流畅。任何帮助表示赞赏。

r shiny
1个回答
0
投票

答案是将 CSS 文件存放在 src 文件夹中的 www 文件夹中,其中包含 ui、全局、布局、服务器功能

© www.soinside.com 2019 - 2024. All rights reserved.