### Run shinydashboardPlus Demo Gallery Source: https://github.com/rinterface/shinydashboardplus/blob/master/index.md Demonstrates the capabilities of the shinydashboardPlus package by launching a gallery of examples. This requires the shinydashboardPlus package to be installed. ```r library(shinydashboardPlus) shinydashboardPlusGallery() ``` -------------------------------- ### Install shinydashboardPlus Package (R) Source: https://github.com/rinterface/shinydashboardplus/blob/master/README.md Provides R code for installing the shinydashboardPlus package. It includes commands for installing from CRAN and the latest version from GitHub. ```r install.packages("shinydashboardPlus") devtools::install_github("RinteRface/shinydashboardPlus") ``` -------------------------------- ### Install shinydashboardPlus Package Source: https://github.com/rinterface/shinydashboardplus/blob/master/index.md Provides R code for installing the shinydashboardPlus package from CRAN or the latest version from GitHub. Ensure you have the devtools package installed for the GitHub installation. ```r # for the CRAN version install.packages("shinydashboardPlus") # for the latest version devtools::install_github("RinteRface/shinydashboardPlus") ``` -------------------------------- ### Create a User Profile Menu with R shinydashboardPlus Source: https://context7.com/rinterface/shinydashboardplus/llms.txt This code example illustrates how to implement a dynamic user profile dropdown menu in the dashboard header using shinydashboardPlus. It includes user information, social links, and actions. Key functions are `renderUser`, `dashboardUser`, and `socialButton`. Dependencies are 'shiny', 'shinydashboard', and 'shinydashboardPlus'. ```r library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader( userOutput("user"), dropdownMenu( type = "notifications", notificationItem("5 new users", icon = icon("users"), status = "info") ) ), sidebar = dashboardSidebar(), body = dashboardBody( h3("Dashboard Content"), actionButton("update_profile", "Update Profile") ), title = "User Profile Demo" ), server = function(input, output, session) { profile_data <- reactiveVal(list( name = "John Doe", title = "Data Scientist", followers = 1250 )) output$user <- renderUser({ data <- profile_data() dashboardUser( name = data$name, image = "https://adminlte.io/themes/AdminLTE/dist/img/user2-160x160.jpg", title = data$title, subtitle = "Member since 2020", footer = p( actionButton("logout", "Sign out", class = "btn-default btn-flat"), class = "text-center" ), fluidRow( dashboardUserItem( width = 6, socialButton( href = "https://github.com", icon = icon("github") ) ), dashboardUserItem( width = 6, socialButton( href = "https://linkedin.com", icon = icon("linkedin") ) ) ), fluidRow( column( width = 12, class = "text-center", h4(data$followers, br(), "Followers") ) ) ) }) observeEvent(input$update_profile, { profile_data(list( name = "Jane Smith", title = "Senior Developer", followers = 2100 )) }) observeEvent(input$logout, { showNotification("Logged out successfully", type = "warning") }) } ) ``` -------------------------------- ### R: Build a Complete Dashboard Page Structure with shinydashboardPlus Source: https://context7.com/rinterface/shinydashboardplus/llms.txt This R code demonstrates how to construct a complete dashboard page using shinydashboardPlus, including header, sidebar, body, controlbar, and footer. It utilizes components like `dashboardPage`, `dashboardHeader`, `dashboardSidebar`, `dashboardBody`, `dashboardControlbar`, and `dashboardFooter`, along with interactive elements like dropdowns and menu items. The example requires the `shiny`, `shinydashboard`, and `shinydashboardPlus` R packages. ```r library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader( title = "My Dashboard", leftUi = tagList( dropdownBlock( id = "mydropdown", title = "Settings", icon = icon("sliders"), sliderInput("n", "Observations", min = 10, max = 100, value = 30) ) ) ), sidebar = dashboardSidebar( id = "sidebar", collapsed = FALSE, sidebarMenu( menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")), menuItem("Settings", tabName = "settings", icon = icon("cog")) ) ), body = dashboardBody( box(title = "Chart", status = "primary", plotOutput("plot")) ), controlbar = dashboardControlbar( id = "controlbar", controlbarMenu( id = "menu", controlbarItem("Tab 1", "Controlbar content here"), controlbarItem("Tab 2", "More settings") ) ), footer = dashboardFooter( left = "By Your Name", right = "2024" ), skin = "blue", title = "Dashboard App" ), server = function(input, output, session) { output$plot <- renderPlot({ hist(rnorm(input$n), main = "Distribution", col = "steelblue") }) } ) ``` -------------------------------- ### User Box and Social Box Components with shinydashboardPlus Source: https://context7.com/rinterface/shinydashboardplus/llms.txt Illustrates the use of specialized box components in R Shiny: `userBox` for displaying user profile information and `socialBox` for creating social media-like posts with attachments and comments. This example showcases customization options for titles, statuses, backgrounds, and content layout. It requires the shiny, shinydashboard, and shinydashboardPlus libraries. ```r library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( fluidRow( userBox( title = userDescription( title = "Nadia Carmichael", subtitle = "Lead Developer", type = 2, image = "https://adminlte.io/themes/AdminLTE/dist/img/user7-128x128.jpg" ), status = "primary", gradient = TRUE, background = "light-blue", width = 6, collapsible = TRUE, p("Senior software engineer with 10 years of experience."), footer = tagList( icon("star"), icon("star"), icon("star"), icon("star"), icon("star") ) ), socialBox( title = userBlock( image = "https://adminlte.io/themes/AdminLTE/dist/img/user4-128x128.jpg", title = "Social Post", subtitle = "Posted 5 hours ago" ), width = 6, "Check out our new dashboard features!", attachmentBlock( image = "https://adminlte.io/themes/AdminLTE/dist/img/photo1.png", title = "Screenshot", href = "https://example.com", "Dashboard preview showing new widgets" ), boxComment( image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", title = "John Doe", date = "Today at 2:30 PM", "Great work! This looks amazing." ), boxComment( image = "https://adminlte.io/themes/AdminLTE/dist/img/user5-128x128.jpg", title = "Jane Smith", date = "Today at 3:15 PM", "Can't wait to try it out!" ) ) ) ) ), server = function(input, output) {} ) ``` -------------------------------- ### R: Create an Enhanced Box with Sidebar and Dropdown using shinydashboardPlus Source: https://context7.com/rinterface/shinydashboardplus/llms.txt This R code illustrates the creation of an advanced box component using shinydashboardPlus, featuring a collapsible sidebar, a dropdown menu, and a status badge. The box is interactive and includes a plot that updates based on user input from sliders and select inputs within the sidebar. This example requires the `shiny`, `shinydashboard`, and `shinydashboardPlus` R packages. ```r library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( id = "mybox", title = "Interactive Box", closable = TRUE, width = 12, status = "warning", solidHeader = FALSE, collapsible = TRUE, collapsed = FALSE, label = boxLabel( text = "3", status = "danger", style = "circle" ), dropdownMenu = boxDropdown( boxDropdownItem("Google", href = "https://www.google.com", icon = icon("link")), boxDropdownItem("Action", id = "boxAction", icon = icon("gear")), dropdownDivider(), boxDropdownItem("Help", icon = icon("question")) ), sidebar = boxSidebar( id = "mycardsidebar", startOpen = FALSE, width = 50, sliderInput("obs", "Observations:", min = 0, max = 1000, value = 500), selectInput("dist", "Distribution:", choices = c("Normal", "Uniform", "Exponential")) ), plotOutput("distPlot") ) ) ), server = function(input, output, session) { output$distPlot <- renderPlot({ req(!input$mybox$collapsed) data <- switch(input$dist, "Normal" = rnorm(input$obs), "Uniform" = runif(input$obs), "Exponential" = rexp(input$obs) ) hist(data, col = "lightblue", main = input$dist) }) observeEvent(input$boxAction, { showNotification("Dropdown action clicked!", type = "message") }) } ) ``` -------------------------------- ### R Shiny Controlbar with Tabbed Menu using shinydashboardPlus Source: https://context7.com/rinterface/shinydashboardplus/llms.txt This R code demonstrates how to implement a collapsible controlbar on the right side of a shinydashboardPlus application. The controlbar features tabbed navigation ('Filters', 'Settings', 'About') allowing users to interact with various input widgets and view information. It includes examples of updating UI elements and showing notifications based on user actions. ```r library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody( actionButton("toggle_controlbar", "Toggle Controlbar"), verbatimTextOutput("controlbar_state"), verbatimTextOutput("menu_selection"), box(title = "Main Content", width = 12, plotOutput("main_plot")) ), controlbar = dashboardControlbar( id = "controlbar", collapsed = FALSE, overlay = TRUE, skin = "dark", width = 250, controlbarMenu( id = "controlbar_menu", controlbarItem( "Filters", sliderInput("n_obs", "Observations:", min = 10, max = 500, value = 100), selectInput("color", "Color:", choices = c("blue", "red", "green")), checkboxInput("show_grid", "Show Grid", TRUE) ), controlbarItem( "Settings", radioButtons("theme", "Theme:", choices = c("Light", "Dark")), numericInput("refresh", "Refresh Rate (s):", value = 5, min = 1, max = 60), actionButton("apply_settings", "Apply", class = "btn-primary btn-block") ), controlbarItem( "About", h4("Dashboard Info"), p("Version: 1.0.0"), p("Author: Your Name"), p("Last Updated: 2024") ) ) ), title = "Controlbar Demo" ), server = function(input, output, session) { output$controlbar_state <- renderPrint({ paste("Controlbar is", if (input$controlbar) "open" else "closed") }) output$menu_selection <- renderPrint({ paste("Active tab:", input$controlbar_menu) }) output$main_plot <- renderPlot({ color <- input$color %||% "blue" plot(rnorm(input$n_obs), col = color, pch = 19, main = paste(input$n_obs, "Random Points")) if (input$show_grid) grid() }) observeEvent(input$toggle_controlbar, { updateControlbar("controlbar") }) observeEvent(input$apply_settings, { showNotification( paste("Settings applied with", input$refresh, "second refresh"), type = "message" ) }) observeEvent(input$controlbar_menu, { updateControlbarMenu("controlbar_menu", selected = input$controlbar_menu) }) } ) ``` -------------------------------- ### Create a Timeline Component with R shinydashboardPlus Source: https://context7.com/rinterface/shinydashboardplus/llms.txt This snippet demonstrates how to create a visual timeline using the `timelineBlock` function from the shinydashboardPlus package. It allows for chronological display of events, labels, items with details, media, and actions. Dependencies include 'shiny', 'shinydashboard', and 'shinydashboardPlus'. ```r library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( timelineBlock( width = 12, timelineStart(color = "gray"), timelineLabel(2024, color = "blue"), timelineItem( title = "Project Launch", icon = icon("rocket"), color = "green", time = "January 15", footer = tagList( actionButton("btn1", "View Details", class = "btn-primary btn-xs"), icon("comments-o"), " 5 comments" ), "Successfully launched version 1.0 of the dashboard.", "Received positive feedback from 50+ users." ), timelineItem( title = "Major Update", icon = icon("code"), color = "orange", time = "March 22", "Deployed new features including real-time updates.", timelineItemMedia(src = "https://placehold.co/150x100/blue/white") ), timelineItem( title = "Team Expansion", icon = icon("users"), color = "purple", time = "June 10", "Hired 3 new developers to accelerate development." ), timelineLabel(2025, color = "red"), timelineItem( title = "Future Plans", icon = icon("flag"), color = "gray", time = "Q1 2025", "Planning integration with external APIs and mobile app release." ), timelineEnd(color = "gray") ) ) ), server = function(input, output) { observeEvent(input$btn1, { showModal(modalDialog( title = "Project Launch Details", "Full details about the project launch...", easyClose = TRUE )) }) } ) ``` -------------------------------- ### R Shiny Custom Dashboard Theme with fresh Package Source: https://context7.com/rinterface/shinydashboardplus/llms.txt This R code demonstrates how to create and apply a custom theme to a shinydashboardPlus application using the 'fresh' package. It defines a 'custom_theme' object with specific color palettes and styling for the adminLTE framework, including colors for headers, sidebars, and global elements. The theme is then applied to a dashboard with various 'box' elements to showcase its visual impact. ```r library(shiny) library(shinydashboard) library(shinydashboardPlus) library(fresh) custom_theme <- create_theme( adminlte_color( light_blue = "#55e7ff", blue = "#2011a2", navy = "#201148", red = "#ff34b3", green = "#00ff88", orange = "#ff9933" ), adminlte_sidebar( dark_bg = "#2c3e50", dark_hover_bg = "#34495e", dark_color = "#ecf0f1", dark_hover_color = "#ffffff", dark_submenu_bg = "#263849", dark_submenu_color = "#bdc3c7" ), adminlte_global( content_bg = "#f9f9f9", box_bg = "#ffffff", info_box_bg = "#ffffff" ) ) shinyApp( ui = dashboardPage( freshTheme = custom_theme, header = dashboardHeader(title = "Custom Theme"), sidebar = dashboardSidebar( sidebarMenu( menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")), menuItem("Charts", tabName = "charts", icon = icon("chart-bar")), menuItem("Tables", tabName = "tables", icon = icon("table")) ) ), body = dashboardBody( fluidRow( box( title = "Box with Custom Colors", status = "primary", solidHeader = TRUE, width = 6, plotOutput("plot1") ), box( title = "Another Box", status = "success", solidHeader = TRUE, gradient = TRUE, width = 6, "Content with gradient background" ) ), fluidRow( box( title = "Warning Box", status = "warning", background = "orange", width = 12, "This box uses the custom orange color from our theme" ) ) ), title = "Custom Theme Demo" ), server = function(input, output) { output$plot1 <- renderPlot({ barplot(1:5, col = c("#55e7ff", "#2011a2", "#ff34b3", "#00ff88", "#ff9933"), names.arg = LETTERS[1:5]) }) } ) ``` -------------------------------- ### R Flip Box: Interactive Flipping Card UI Source: https://context7.com/rinterface/shinydashboardplus/llms.txt Implements an interactive flip box component in R Shiny using shinydashboardPlus. This component allows content to flip between a front and back side, triggered by user interaction like click or hover. It requires the 'shiny', 'shinydashboard', and 'shinydashboardPlus' libraries. ```r library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( fluidRow( column( width = 6, actionButton("toggle", "Toggle Flip Box"), uiOutput("active_side"), flipBox( id = "myflipbox", trigger = "click", width = 12, front = div( class = "text-center", h1("Click to Flip"), img( src = "https://image.flaticon.com/icons/svg/149/149076.svg", height = "300px", width = "100%" ) ), back = div( class = "text-center", style = "height: 300px; padding-top: 80px;", h1("Back Side"), p("This is the back content with more details."), p("Add any Shiny UI elements here!") ) ) ) ) ) ), server = function(input, output, session) { output$active_side <- renderUI({ side <- if (input$myflipbox) "front" else "back" dashboardBadge(side, color = "blue") }) observeEvent(input$toggle, { updateFlipBox("myflipbox") }) observeEvent(input$myflipbox, { showNotification( paste("Showing:", if (input$myflipbox) "front" else "back"), type = "message" ) }) } ) ``` -------------------------------- ### Update Box Dynamically with shinydashboardPlus Source: https://context7.com/rinterface/shinydashboardplus/llms.txt Demonstrates how to programmatically control the state and properties of a box component in a Shiny application. It utilizes functions like updateBox to toggle collapse, remove, restore, or update the box's title, status, and other visual options. Dependencies include the shiny, shinydashboard, and shinydashboardPlus libraries. ```r library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( fluidRow( actionButton("toggle_box", "Toggle Box"), actionButton("remove_box", "Remove Box", class = "bg-danger"), actionButton("restore_box", "Restore Box", class = "bg-success"), actionButton("update_box", "Update Box", class = "bg-info") ), br(), box( id = "mybox", title = textOutput("box_state"), status = "danger", background = "maroon", gradient = TRUE, collapsible = TRUE, closable = TRUE, plotOutput("plot") ) ) ), server = function(input, output, session) { output$plot <- renderPlot({ req(!input$mybox$collapsed) plot(rnorm(200), main = "Random Data") }) output$box_state <- renderText({ state <- if (input$mybox$collapsed) "collapsed" else "expanded" paste("Box is", state) }) observeEvent(input$toggle_box, { updateBox("mybox", action = "toggle") }) observeEvent(input$remove_box, { updateBox("mybox", action = "remove") }) observeEvent(input$restore_box, { updateBox("mybox", action = "restore") }) observeEvent(input$update_box, { updateBox("mybox", action = "update", options = list( title = h2("Updated Title", dashboardLabel(1, status = "primary")), status = "success", solidHeader = TRUE, width = 12, background = NULL, height = "600px" )) }) observeEvent(input$mybox$visible, { visible <- if (input$mybox$visible) "visible" else "hidden" showNotification(paste("Box is", visible), duration = 2) }) } ) ``` -------------------------------- ### R Accordion: Collapsible Content Panels UI Source: https://context7.com/rinterface/shinydashboardplus/llms.txt Implements a collapsible accordion component in R Shiny using shinydashboardPlus. This component organizes content into expandable sections, allowing users to toggle visibility. It requires the 'shiny', 'shinydashboard', and 'shinydashboardPlus' libraries. ```r library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( radioButtons("controller", "Select Panel:", choices = c("1", "2", "3")), verbatimTextOutput("selected"), accordion( id = "myaccordion", width = 12, accordionItem( title = "Project Overview", status = "danger", collapsed = TRUE, solidHeader = TRUE, p("This project aims to build a comprehensive dashboard."), plotOutput("plot1") ), accordionItem( title = "Data Analysis", status = "warning", collapsed = FALSE, solidHeader = TRUE, p("Key findings from the data analysis phase."), tableOutput("table1") ), accordionItem( title = "Conclusions", status = "success", collapsed = TRUE, solidHeader = TRUE, p("Summary and next steps for the project.") ) ) ) ), server = function(input, output, session) { output$plot1 <- renderPlot({ barplot(c(10, 20, 30), names.arg = c("A", "B", "C"), col = "coral") }) output$table1 <- renderTable({ data.frame(Metric = c("Sales", "Users", "Revenue"), Value = c(1500, 3200, 45000)) }) output$selected <- renderPrint({ paste("Currently selected panel:", input$myaccordion) }) observeEvent(input$controller, { updateAccordion(id = "myaccordion", selected = input$controller) }) observeEvent(input$myaccordion, { showNotification( sprintf("Panel %s opened", input$myaccordion), type = "message", duration = 2 ) }) } ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.