I'am in the process of creating a shiny dashbord, I create 3 tabItems the problem is that when I click on one of the menuItem I can not click on again, i can't switch between the tabItems . Can someone help me please the code R #UI
library(shiny)
library(shinydashboard)
shinyUI(dashboardPage(skin = "black",
dashboardHeader(title = h4("Tableau de bord des élections",style = "color:navy"),
titleWidth = 300
),
dashboardSidebar(id="",
menuItem(h4(strong("Dashboard", align = "center")), tabName = "dashboard"),
menuItem(h4(strong("Prédiction")), tabName = "Prédiction"),
menuItem(h4(strong("Interprétation")), tabName = "Interprétation")),
dashboardBody(
tabItems(
tabItem(tabName = "dashboard",h2("Analyse du comportement électoral des citoyens tunisiens", align="center",style = "color:navy") ),
tabItem(tabName = "Prédiction", h2("Prédiction du vote", align="center",style = "color:blue")),
tabItem(tabName = "Interprétation", h2("Interprétation"))
)
)))
I know that your problem has been solved and that you probably won't change your code ~1years later, but for others like me encountering this problem I have a simpler solution.
You have to wrap all "menuItem" in the sideBarMenu() fonction. This will solve the problem and make the items in the menu bigger.
library(shiny)
library(shinydashboard)
shinyUI(dashboardPage(skin = "black",
dashboardHeader(title = h4("Tableau de bord des élections",style =
"color:navy"),
titleWidth = 300
),
dashboardSidebar(id="", sidebarMenu(
menuItem(h4(strong("Dashboard", align = "center")), tabName = "dashboard"),
menuItem(h4(strong("Prédiction")), tabName = "Prédiction"),
menuItem(h4(strong("Interprétation")), tabName = "Interprétation"))),
dashboardBody(
tabItems(
tabItem(tabName = "dashboard",h2("Analyse du comportement électoral des citoyens tunisiens", align="center",style = "color:navy") ),
tabItem(tabName = "Prédiction", h2("Prédiction du vote", align="center",style = "color:blue")),
tabItem(tabName = "Interprétation", h2("Interprétation"))
)
)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With