Description Usage Arguments Author(s) Examples
navPills creates a container for nav elements. They are vertically stacked. To insert in box.
updateNavPills allows to programmatically change the currently selected navPillsItem on the client.
navPillsItem creates a nav pill item.
1 2 3 4 5 6 7 8 9 10 11 | navPills(..., id = NULL)
updateNavPills(id, selected, session = shiny::getDefaultReactiveDomain())
navPillsItem(
left = NULL,
right = NULL,
color = NULL,
icon = NULL,
selected = FALSE
)
|
... |
slot for navPillsItem. |
id |
navPills unique id to target. |
selected |
Whether the item is active or not. FALSE by default. |
session |
Shiny session object. |
left |
pill left text. |
right |
pill right text. |
color |
pill color: see here for a list of valid colors https://adminlte.io/themes/AdminLTE/pages/UI/general.html. See below:
|
icon |
pill icon, if any. |
David Granjon, dgranjon@ymail.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | # navPills
if (interactive()) {
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
shinyApp(
ui = dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
box(
title = "Nav Pills",
status = "info",
"Box Body",
footer = navPills(
id = "pillItem",
navPillsItem(
left = "Item 1",
color = "green",
right = 10
),
navPillsItem(
left = "Item 2",
color = "red",
icon = icon("angle-down"),
right = "10%",
active = TRUE
)
)
)
),
title = "Nav Pills"
),
server = function(input, output) {
observeEvent(input$pillItem, {
showNotification(sprintf("You clicked on pill N° %s", input$pillItem), type = "message")
})
}
)
}
# update navPills
if (interactive()) {
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
shinyApp(
ui = dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
radioButtons("controller", "Controller", choices = c(1, 2, 3)),
br(),
box(
title = "Nav Pills",
status = "info",
"Box Body",
footer = navPills(
inputId = "pills",
navPillsItem(
left = "Item 1",
color = "green",
right = 10
),
navPillsItem(
left = "Item 2",
color = "red",
icon = icon("angle-down"),
right = "10%"
),
navPillsItem(
left = "Item 3",
color = "blue",
icon = icon("angle-up"),
right = "30%"
)
)
)
),
title = "Nav Pills"
),
server = function(input, output, session) {
observeEvent(input$controller, {
updateNavPills(id = "pills", selected = input$controller)
})
observeEvent(input$pills, {
showNotification(sprintf("You selected pill N° %s", input$pills), type = "message")
})
}
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.