We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have also described it in the bs4Dash github:
RinteRface/bs4Dash#389
So I love to use bs4Dash but things go wrong if i want to add header menu's as explained here:
https://bs4dash.rinterface.com/reference/navbar-menu
This code works perfectly, but not with golem.
Somehow I get the word 'navmenu' and 'left' added to the header plus dots in the left corner.
library(golem) create_golem("Test")
golem::add_module(name = "tabs")
# R/mod_tabs.R mod_tabs_ui <- function(id) { ns <- NS(id) tabItems(.list = lapply(1:7, function(i) { tabItem(tabName = sprintf("Tab%s", i), sprintf("Tab %s", i)) })) } mod_tabs_server <- function(id) { moduleServer(id, function(input, output, session) { # No specific server logic for tabs in this case }) }
# R/app_ui.R app_ui <- function(request) { tagList( golem_add_external_resources(), 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(mod_tabs_ui("tabs")), # Use module here controlbar = dashboardControlbar( sliderInput( inputId = "controller", label = "Update the first tabset", min = 1, max = 4, value = 1 ) ), sidebar = dashboardSidebar(disable = TRUE) ) ) }
# R/app_server.R app_server <- function(input, output, session) { mod_tabs_server("tabs") # Initialize module observeEvent(input$controller, { updateNavbarTabs( session, inputId = "navmenu", selected = paste0("Tab", input$controller) ) }, ignoreInit = TRUE ) }
The text was updated successfully, but these errors were encountered:
@ArthurData can you please have a look to that ?
Sorry, something went wrong.
Hello @HugoGit39 👋
Thanks for your code — it helped me reproduce the bug! 🙏
In {golem}, within the app_ui.R file, we import all the functions from {shiny} using:
{golem}
app_ui.R
{shiny}
#' @import shiny
So that also includes the navbarMenu() function... from {shiny}!
navbarMenu()
If you're using navbarMenu() from another package (like {bs4Dash}, for example 😛 ), make sure to call it explicitly with the namespace, e.g.:
{bs4Dash}
bs4Dash::navbarMenu(...)
Your code:
bs4Dash::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") ) ) ) )
Alternatively, to make things clearer and avoid potential conflicts, you could be more explicit with the functions you import, using:
#' @importFrom shiny navbarPage fluidPage ...
That way, only the functions you really need are brought into the namespace, which can help prevent this kind of issue.
ColinFay
ArthurData
No branches or pull requests
I have also described it in the bs4Dash github:
RinteRface/bs4Dash#389
So I love to use bs4Dash but things go wrong if i want to add header menu's as explained here:
https://bs4dash.rinterface.com/reference/navbar-menu
This code works perfectly, but not with golem.
Somehow I get the word 'navmenu' and 'left' added to the header plus dots in the left corner.
golem::add_module(name = "tabs")
The text was updated successfully, but these errors were encountered: