Comments (4)
Hi,
Like for {shinydashboard}
, the menuItem()
function has been thought to accept menuSubItem()
. In the above example, sometimes, you pass in other menuItem()
which likely fails.
From a practical point of view, do you need all these menus? This seems to be a lot from a UX perspective and I am afraid end users can get lost. I would perhaps merge few items together and create sub-sections directly in the dashboard body.
As another alternative, {bs4Dash}
2.3.0 (CRAN) supports navbar menus with unlimited nested structure:
library(shiny)
library(bs4Dash)
tabs <- tabItems(.list = lapply(1:7, function(i) {
tabItem(tabName = sprintf("Tab%s", i), sprintf("Tab %s", i))
}))
shinyApp(
ui = dashboardPage(
header = dashboardHeader(
navbarMenu(
id = "navmenu",
navbarTab(tabName = "Tab1", text = "Tab 1"),
navbarTab(tabName = "Tab2", text = "Tab 2"),
navbarTab(
text = "Menu",
dropdownHeader("Dropdown header"),
navbarTab(tabName = "Tab3", text = "Tab 3"),
dropdownDivider(),
navbarTab(
text = "Sub menu",
dropdownHeader("Another header"),
navbarTab(tabName = "Tab4", text = "Tab 4"),
dropdownHeader("Yet another header"),
navbarTab(tabName = "Tab5", text = "Tab 5"),
navbarTab(
text = "Sub sub menu",
navbarTab(tabName = "Tab6", text = "Tab 6"),
navbarTab(tabName = "Tab7", text = "Tab 7")
)
)
)
)
),
body = dashboardBody(tabs),
controlbar = dashboardControlbar(
sliderInput(
inputId = "controller",
label = "Update the first tabset",
min = 1,
max = 4,
value = 1
)
),
sidebar = dashboardSidebar(disable = TRUE)
),
server = function(input, output, session) {
observeEvent(input$controller, {
updateNavbarTabs(
session,
inputId = "navmenu",
selected = paste0("Tab", input$controller)
)
},
ignoreInit = TRUE
)
}
)
from bs4dash.
Any news about the old behaviour where menuItem accepted other menuItems?
I have not a so complicated sidebar as the first example but looks better than using navbar
sidebarMenu(
id = 'sidebarmenu',
flat = FALSE,
compact = TRUE,
legacy = FALSE,
menuItem(tabName = 'about', text = 'About', icon = icon('circle-info')),
menuItem(
text = 'My apps',
icon = icon('bars'),
menuItem(
text = 'App 1',
icon = icon('arrow-right'),
menuSubItem(tabName = 'app1-1', text = 'App 1-1', icon = icon('arrow-right')),
menuSubItem(tabName = 'app1-2', text = 'App 1-2', icon = icon('arrow-right')),
menuSubItem(tabName = 'app1-3', text = 'App 1-3', icon = icon('arrow-right'))
),
menuItem(
text = 'App 2',
icon = icon('arrow-right'),
menuSubItem(tabName = 'app2-1', text = 'App 2-1', icon = icon('arrow-right')),
menuSubItem(tabName = 'app2-2', text = 'App 2-2', icon = icon('arrow-right')),
menuSubItem(tabName = 'app2-3', text = 'App 2-3', icon = icon('arrow-right'))
)
)
)
from bs4dash.
Same problem here:
library(shiny)
library(bs4Dash)
# UI ----------------------------------------------------------------------
ui <- dashboardPage(
#dark = T,
header = dashboardHeader(title = "Test Shiny"),
sidebar = dashboardSidebar(
inputId = "sidebarState",
skin = "dark",
sidebarMenu(
id = "sidebar",
menuItem(text = "Home",tabName = "home"),
menuItem(text = "CDG", tabName = "cdg",
menuItem(text = "Variabili Produttive",tabName = "VP",
menuItem(text = "VP Domanda",tabName = "vp_domanda",
menuSubItem(text = "a",tabName = "vp_domanda_a"),
menuSubItem(text = "b",tabName = "vp_domanda_b"),
menuSubItem(text = "c",tabName = "vp_domanda_c")),
menuItem(text = "VP Offerta",tabName = "vp_offerta")),
menuItem(text = "Indicatori",tabName = "indic"))
)
),
body = dashboardBody()
)
# Server ------------------------------------------------------------------
server <- function(input, output) {
}
# Run App -----------------------------------------------------------------
# Run the application
shinyApp(ui = ui, server = server)
Error in subItems[[i]] : subscript out of bounds
The catch is that if I run the same code with shinydashboard instead of bs4Dash it runs flawlessly.
from bs4dash.
I'm still using version 2.2.1
from bs4dash.
Related Issues (20)
- Possibility of user-defined custom toggles [enhancement] HOT 5
- Problem with the header HOT 2
- menuItem with menuSubItem HOT 1
- Start a box invisible HOT 1
- bs4DashGallery() does not work for me HOT 7
- Right control of carousel is broken
- Will bs4Dash going to support bootstrap 5? HOT 9
- List of icon
- Leaflet map width after maximizing box HOT 1
- Error in version 2.3.0 but not 2.2.1: 'Uncought error: cannot call methods on tooltip prior to initialization' HOT 1
- Dark and help toggle always show up
- Place the theme switch button in the center relative to the vertical
- I wish there was an updatebs4TabCard function. HOT 2
- bs4dash with sever package conflict box=TRUE doesnt work HOT 1
- Request to upgrade jQuery UI
- Persistent Theme Selection Error in dashboardHeader Function of ds4Dash Package HOT 1
- Request for function to zoom out screen in bs4dash
- `popover()` doesn't work HOT 2
- allow HTML tags inside `popover()`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bs4dash.