顺便说一句,这是一个关于 bslib 的问题,这是一个很棒的包。
我想知道它是否主要用于shiny 和flexdashborad,或者它也可以与shinydashboard 一起使用。
谢谢!
我如何找出 rmarkdown / bslib 使用哪个 bootstrap scss 变量来为页面元素着色?例如为目录背景着色?
这是一个页面的yaml
output:
html_document:
self_contained: false
theme:
version: 4
bootswatch: cyborg
toc: yes
toc_depth: 3
toc_float:
collapsed: true
Run Code Online (Sandbox Code Playgroud) 我如何使用bslib类似的行为shinydashboard?我特别对带有手风琴的侧边栏感兴趣。当选择一项时,我想选择一个预定义的page_fluid对象。
我试图定义一个看起来像侧边栏菜单的手风琴。我想出了
ui <- bslib::page_navbar(
sidebar=bslib::sidebar(
bslib::accordion(
shiny::actionButton(inputId = "btn_start", label = "Start"),
shiny::actionButton(inputId = "btn_overview", label = "Overview"),
bslib::accordion_panel(
"Menu Level 1",
shiny::actionButton(inputId="btn_lvl1_a", label="Menu Level 1a"),
shiny::actionButton(inputId="btn_lvl1_b", label="Menu Level 1b")
),
bslib::accordion_panel(
"Menu Level 2",
shiny::actionButton(inputId="btn_lvl2_a", label="Menu Level 2a"),
shiny::actionButton(inputId="btn_lvl2_b", label="Menu Level 2b"),
shiny::actionButton(inputId="btn_lvl2_c", label="Menu Level 2c")
)
)
)
)
server <- function(input, output, session) {
}
shiny::shinyApp(ui, server)
Run Code Online (Sandbox Code Playgroud)
并计划observeEvent点击actionButton,但这似乎不是定义菜单的正确方法。看起来很奇怪。
一个最小的例子将不胜感激。
在我闪亮的应用程序中,我有一个允许更改主题应用程序的选项。
有没有办法创建一个主题,其中只有导航栏是彩色的,而主体是黑色或白色的?
我知道可以使用 CSS 来完成此操作,但由于我可以更改应用程序中的主题,因此无法进行自定义修复。
library(shiny)
library(markdown)
library(bslib)
main_theme = bslib::bs_theme(
bg = "#86cecb",
fg = "#e12885",
primary = "#89cff0",
)
ui = navbarPage(
"Navbar!",
theme = main_theme,
tabPanel("Plot",
sidebarLayout(
sidebarPanel(radioButtons(
"plotType", "Plot type",
c("Scatter" = "p", "Line" = "l")
)),
mainPanel(plotOutput("plot"))
)),
navbarMenu(title = "Ressources",
tabPanel(
"Options d'interface",
selectInput(
"theme",
"Themes :",
c(
"Custom" = "custom",
"Dark" = "dark",
"Light" = "light"
)
)
))
)
server = function(input, output, session) {
light <- bs_theme()
dark <- bslib::bs_theme(
bg …Run Code Online (Sandbox Code Playgroud)