dropdown down menu on the left side of the dashboard header

Hi
I am trying to run the example provided in shinydashboardPlus.pdf (crab r documentation) for drop.
browsed the net and all examples are similar and shows similar error. I am missing something somewhere, could someone guide me, Thanks
Error message
Error in FUN(X[[i]], ...) : Expected an object with class 'shiny.tag'

code from documentation:
if (interactive()) {
library(shiny)
library(shinyWidgets)
library(shinydashboard)
library(shinydashboardPlus)
shinyApp(
ui = dashboardPage(
header = dashboardHeader(
leftUi = tagList(
dropdownBlock(
id = "mydropdown",
title = "Dropdown 1",
icon = icon("sliders"),
sliderInput(
inputId = "n",
label = "Number of observations",
min = 10, max = 100, value = 30
),
prettyToggle(
inputId = "na",
label_on = "NAs kept",
label_off = "NAs removed",
icon_on = icon("check"),
icon_off = icon("remove")
)
),
dropdownBlock(
id = "mydropdown2",
title = "Dropdown 2",
icon = icon("sliders"),
prettySwitch(
inputId = "switch4",
label = "Fill switch with status:",
fill = TRUE,
status = "primary"
),
prettyCheckboxGroup(
inputId = "checkgroup2",
label = "Click me!",
thick = TRUE,
choices = c("Click me !", "Me !", "Or me !"),
animation = "pulse",
status = "info"
)
)
),
dropdownMenu(
type = "tasks",
badgeStatus = "danger",
taskItem(value = 20, color = "aqua", "Refactor code"),
taskItem(value = 40, color = "green", "Design new layout"),
taskItem(value = 60, color = "yellow", "Another task"),
taskItem(value = 80, color = "red", "Write documentation")
)
),
sidebar = dashboardSidebar(),
body = dashboardBody(
setShadow(class = "dropdown-menu")
),
title = "DashboardPage"
),
server = function(input, output) { }
)
}

My guess is you've loaded shinydashboardPlus before loading shinydashboard, so your dashboard header is trying to use shinydashboard::dashboardHeader (which expects all elements to be shiny tags) as opposed to shinydashboardPlus::dashboardHeader (which has additional arguments).

Try using shinydashboardPlus::dashboardHeader instead of just dashboardHeader, or just restart your R session and load the packages in the correct order.

Good catch, Thank you very much, I have tested , problem resolved.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.