rstudio / shinydashboard

Shiny Dashboarding framework
https://rstudio.github.io/shinydashboard/
Other
893 stars 298 forks source link

Feature request: allow NULLs / empty tagList() in Dashboard header #302

Open AshesITR opened 5 years ago

AshesITR commented 5 years ago

https://github.com/rstudio/shinydashboard/blob/9158ee083cb852922c65e82c292271046f85b9ee/R/dashboardHeader.R#L90-L91

If we drop all null or empty values in items before doing tagAssert, we can allow modular code such as this to function properly:

dashboardHeader(
    title = "Title",
    if (my_condition) dropdownMenu(...) else NULL, # Only include dropdown if a condition is satisfied (e.g. read this from a config file)
    dropdownMenu(...) # Other dropdown
)

This behaviour would be consistent with dashboardBody() (this relies on shiny::tag(...))

I'll gladly do a PR if the feature is considered useful for others as well.