Skip to contents

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"
)
#> <div class="user-panel">
#>   <img src="some_image_located_inside_www_dir.jpg" class="ui mini circular left floated image"/>
#>   <p>Some Name</p>
#>   <a href="#">
#>     <i class="circle icon"></i>
#>     Online
#>   </a>
#> </div>

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)
}