bs4DropdownMenu | R Documentation |
dropdownMenu creates an adminLTE3 dashboard dropdown menu, to be inserted in a dashboardHeader.
messageItem creates a message item to place in a dropdownMenu.
messageItem creates a message item to place in a dropdownMenu.
taskItem creates a task item to place in a dropdownMenu.
bs4DropdownMenu(
...,
type = c("messages", "notifications", "tasks"),
badgeStatus = "primary",
icon = NULL,
headerText = NULL,
.list = NULL,
href = NULL
)
messageItem(
from,
message,
icon = shiny::icon("user"),
time = NULL,
href = NULL,
image = NULL,
color = "secondary",
inputId = NULL
)
notificationItem(
text,
icon = shiny::icon("triangle-exclamation"),
status = "success",
href = NULL,
inputId = NULL
)
taskItem(text, value = 0, color = "info", href = NULL, inputId = NULL)
dropdownMenu(
...,
type = c("messages", "notifications", "tasks"),
badgeStatus = "primary",
icon = NULL,
headerText = NULL,
.list = NULL,
href = NULL
)
... |
Items to put in the menu. Typically, message menus should contain
|
type |
The type of menu. Should be one of "messages", "notifications", "tasks". |
badgeStatus |
The status of the badge which displays the number of items in the menu. This determines the badge's color. Valid statuses are defined as follows:
.
A value of |
icon |
An icon tag, created by |
headerText |
An optional text argument used for the header of the
dropdown menu (this is only visible when the menu is expanded). If none is
provided by the user, the default is "You have |
.list |
An optional list containing items to put in the menu Same as the
|
href |
An optional URL to link to. |
from |
Who the message is from. |
message |
Text of the message. |
time |
String representing the time the message was sent. Any string may be used. For example, it could be a relative date/time like "5 minutes", "today", or "12:30pm yesterday", or an absolute time, like "2014-12-01 13:45". If NULL, no time will be displayed. |
image |
User image. |
color |
A color for the bar. Valid colors are defined as follows:
|
inputId |
Whether to allow the item to act as a actionButton. |
text |
The task text. |
status |
The status of the item. This determines the item's background color. Valid statuses are defined as follows:
|
value |
A percent value to use for the bar. |
David Granjon, dgranjon@ymail.com
dashboardHeader
for example usage.
if (interactive()) {
library(shiny)
library(bs4Dash)
shinyApp(
ui = dashboardPage(
header = dashboardHeader(
rightUi = dropdownMenu(
badgeStatus = "danger",
type = "messages",
messageItem(
inputId = "triggerAction1",
message = "message 1",
from = "Divad Nojnarg",
image = "https://adminlte.io/themes/v3/dist/img/user3-128x128.jpg",
time = "today",
color = "lime"
)
),
leftUi = tagList(
dropdownMenu(
badgeStatus = "info",
type = "notifications",
notificationItem(
inputId = "triggerAction2",
text = "Error!",
status = "danger"
)
),
dropdownMenu(
badgeStatus = "info",
type = "tasks",
taskItem(
inputId = "triggerAction3",
text = "My progress",
color = "orange",
value = 10
)
)
)
),
sidebar = dashboardSidebar(),
controlbar = dashboardControlbar(),
footer = dashboardFooter(),
title = "dropdownMenu",
body = dashboardBody()
),
server = function(input, output) {
observeEvent(input$triggerAction1, {
showModal(modalDialog(
title = "Important message",
"This is an important message!"
))
})
}
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.