提问人:Muesgen 提问时间:11/10/2023 更新时间:11/10/2023 访问量:24
在 Shiny R 中在整个屏幕宽度上显示 navbarMenu
Display navbarMenu across complete screen width in Shiny R
问:
我想使用带有 4 个导航栏菜单的闪亮导航栏页面。它们应彼此相邻水平显示,并且是可选的。只有当整个屏幕的屏幕宽度太小而无法显示时,导航栏菜单才应按垂直顺序显示。如何在整个屏幕宽度上显示导航栏菜单并防止它们提前垂直显示?在这两张图像中,您可以看到垂直结构在使用整个屏幕宽度之前显示。
这是我的代码:
library(shiny)
ui <- navbarPage(
title=NULL, id = "navBar", collapsible = FALSE,
navbarMenu("Menu1",
tabPanel(title = "Panel1", uiOutput('panel1')),
tabPanel(title = "Panel2", uiOutput('panel2')),
tabPanel(title = "Panel3", uiOutput('panel3'))),
navbarMenu("Menu2",
tabPanel(title = "Panel4", uiOutput('panel4')),
tabPanel(title = "Panel5", uiOutput('panel5')),
tabPanel(title = "Panel6", uiOutput('panel6'))),
navbarMenu("Menu3",
tabPanel(title = "Panel7", uiOutput('panel7')),
tabPanel(title = "Panel8", uiOutput('panel8')),
tabPanel(title = "Panel9", uiOutput('panel9'))),
navbarMenu("Menu4",
tabPanel(title = "Panel10", uiOutput('panel10')),
tabPanel(title = "Panel11", uiOutput('panel11')),
tabPanel(title = "Panel12", uiOutput('panel12'))),
)
server <- function(input, output, session) {
output$panel1 <- renderUI({p("This is panel 1")})
output$panel2 <- renderUI({p("This is panel 2")})
output$panel3 <- renderUI({p("This is panel 3")})
output$panel4 <- renderUI({p("This is panel 4")})
output$panel5 <- renderUI({p("This is panel 5")})
output$panel6 <- renderUI({p("This is panel 6")})
output$panel7 <- renderUI({p("This is panel 7")})
output$panel8 <- renderUI({p("This is panel 8")})
output$panel9 <- renderUI({p("This is panel 9")})
output$panel10 <- renderUI({p("This is panel 10")})
output$panel11 <- renderUI({p("This is panel 11")})
output$panel12 <- renderUI({p("This is panel 12")})
}
shinyApp(ui = ui, server = server)
答: 暂无答案
评论