我有一些构建R-Shiny应用程序的经验,但是我是材料设计的新手。偶然发现了Shinymaterial程序包,但是很棒,但是它缺少Shiny-Bootstrap UI框架提供的某些功能,例如手风琴/扩展面板。
shinymaterial包中有material_card()来创建卡,我想知道是否有一种方法可以添加一些HTML来启用material_card函数的扩展/折叠功能,并使用HTML和/或标签$ div js的tags $ script。
这是我下面的(悲伤)尝试。参见reprex:
library(shiny)
library(shinymaterial)
# Wrap shinymaterial apps in material_page
ui <- material_page(
title = "Basic Page + Side-Nav + Tabs",
# Place side-nav in the beginning of the UI
material_side_nav(
fixed = FALSE,
tags$h3("Side-Nav Content")
),
# Define tabs
material_row(
material_tabs(
tabs = c(
"First Tab" = "first_tab",
"Second Tab" = "second_tab"
)
),
material_column(width = 8,
# Define tab content
material_tab_content(
tab_id = "first_tab",
material_card(title = "mycard",
tags$h1("First Tab Content"),
tags$div(
HTML("<mat-card>
<mat-card-header>
<mat-card-title style='font-size: 20px;'>mycard</mat-card-title>
</mat-card-header>
<mat-card-content *ngIf='!collapsed'>
<p>This is some example text.</p>
<p>This text will disappear when you use the action button in the actions bar below.</p>
</mat-card-content>
<mat-card-actions>
<button mat-button (click)='collapsed=true'>Collapse text</button>
<button mat-button (click)='collapsed=false'>Uncollapse text</button>
</mat-card-actions>
</mat-card>")
)
)
),
material_tab_content(
tab_id = "second_tab",
material_card(title = NULL,
tags$h1("Second Tab Content")
)
)
),
material_column(width=4,
div(style='padding:15px;'),
material_tabs(
tabs = c(
"Third Tab" = "third_tab",
"Fourth Tab" = "fourth_tab"
)
),
material_tab_content(
tab_id = "third_tab",
material_card(title = NULL,
tags$h1("Third Tab Content")
)
),
material_tab_content(
tab_id = "fourth_tab",
material_card(title = NULL,
tags$h1("Fourth Tab Content")
)
)
)
)
)
server <- function(input, output) {
}
shinyApp(ui = ui, server = server)