sidebar_user_panel: Create a user panel

View source: R/menu_item.R

sidebar_user_panelR Documentation

Description

This creates an user panel using Semantic UI styles.

Usage

sidebar_user_panel(name, subtitle = NULL, image = NULL, image_size = "tiny")

sidebarUserPanel(name, subtitle = NULL, image = NULL, image_size = "tiny")

Arguments

name

Name of the user

subtitle

Information to be displayed below the name (for example if the user is online)

image

Path to an image. This can be a relative link to an existing 'www/' directory, or an URL to an image

image_size

CSS class to display the image, see Semantic documentation for all sizes (goes from 'mini' to 'massive')

Value

A div tag with the user panel

Functions

  • sidebarUserPanel(): Create a sidebar user panel (alias for sidebar_user_panel for compatibility with shinydashboard)

Examples

sidebarUserPanel(
  "Some Name",
  subtitle = shiny::a(href = "#", icon("circle"), "Online"),
  # Image file should be in www/ subdir
  # or a link to a image
  image = "some_image_located_inside_www_dir.jpg",
  image_size = "mini"
)

ui_user <- sidebarUserPanel(
  "Jane Smith",
  subtitle = shiny::a(href = "#", icon("circle"), "Online"),
  # Image file should be in www/ subdir
  # or a link to a image
  image = base::system.file(
    file.path('examples', "www", "jane_smith.jpg"),
    package = "semantic.dashboard"
  ),
  image_size = "mini"
)

if (interactive()) {
  ui <- dashboardPage(
    dashboardHeader(),
    dashboardSidebar(
      ui_user,
      sidebarMenu(
        menuItem("Tab 1", tabName = "tab1"),
        menuItem("Tab 2", tabName = "tab2")
      )
    ),
    body = dashboardBody(
      tabItems(
        tabItem(tabName = "tab1", h2("Tab 1")),
        tabItem(tabName = "tab2", h2("Tab 2"))
      )
    )
  )

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

Appsilon/semantic.dashboard documentation built on April 21, 2024, 2:42 p.m.