Skip to content
New issue

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

Added a new optional argument, called headerText to the dropdownMenu() function #207

Merged
merged 1 commit into from
Apr 26, 2017

Conversation

bborgesr
Copy link
Contributor

@bborgesr bborgesr commented Apr 26, 2017

If provided by the user, this text (instead of the default) will be shown on the header of the menu (only visible when the menu is expanded).

Closes #165.

Example app (covers 3 scenarios):

library(shiny)
library(shinydashboard)

messages <- list(
  messageItem("Support", "This is the content of a message.", time = "5 mins"),
  messageItem("Support", "This is the content of another message.", time = "2 hours"),
  messageItem("New User", "Can I get some help?", time = "Today" )
)

notifications <- list(
  notificationItem(icon = icon("users"), status = "info", "5 new members joined today"),
  notificationItem(icon = icon("warning"), status = "danger", "Resource usage near limit."),
  notificationItem(icon = icon("shopping-cart", lib = "glyphicon"),  status = "success", "25 sales made"),
  notificationItem(icon = icon("user", lib = "glyphicon"), status = "danger", "You changed your username")
)

tasks <- list(
  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")
)

ui <- dashboardPage(
  dashboardHeader(
    title = "Dashboard Demo",
    
    # Keeps default text
    dropdownMenu(type = "messages", badgeStatus = "success", .list = messages),
    
    # Overrides default text
    dropdownMenu(type = "notifications", badgeStatus = "warning",
      headerText = "These are important notifications!",
      .list = notifications
    ),
    
    # Overrides default text in a more complicated way
    dropdownMenu(type = "tasks", badgeStatus = "danger",
      .list = tasks, headerText = paste("Tens", length(tasks), "tarefas.")
    )
  ),
  dashboardSidebar(),
  dashboardBody()
)

server <- function(input, output, session) {}
shinyApp(ui, server)

… the `dropdownMenu()` function. If provided by the user, this text (instead of the default) will be shown on the header of the menu (only visible when the menu is expanded).
@wch wch merged commit 6472511 into master Apr 26, 2017
@wch wch deleted the barbara/custom-dropdown-header branch April 26, 2017 14:42
@wch wch removed the in progress label Apr 26, 2017
@federicomarini
Copy link

Great, thank you @bborgesr and @wch !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants