R/Shiny/bs4Dashの基礎③


サイドバーの実装

こんな感じで実装できる(雑)。iconはここから参照する。

library(shiny)
library(bs4Dash)

ui <- bs4DashPage(
  navbar = bs4DashNavbar(),
  sidebar = bs4DashSidebar(
    bs4SidebarMenu(
      bs4SidebarHeader(title = "x"),
      bs4SidebarMenuItem(text = "x1", tabName = "x1", icon = "bar-chart"),
      bs4SidebarMenuItem(text = "x2", tabName = "x2", icon = "thermometer-quarter"),
      bs4SidebarMenuItem(text = "x3", tabName = "x3", icon = "snowflake-o"),
      bs4SidebarHeader(title = "y"),
      bs4SidebarMenuItem(text = "y1", tabName = "y1", icon = "ravelry"),
      bs4SidebarMenuItem(text = "y2", tabName = "y2", icon = "user-circle-o "),
      bs4SidebarMenuItem(text = "y3", tabName = "y3", icon = "car"),
      bs4SidebarHeader(title = "z"),
      bs4SidebarMenuItem(
        text = "z1",
        bs4SidebarMenuSubItem(text = "z11", tabName = "z11", icon = "area-chart"),
        bs4SidebarMenuSubItem(text = "z12", tabName = "z12", icon = "battery-full"),
        bs4SidebarMenuSubItem(text = "z13", tabName = "z13", icon = "bell-slash"),
        icon ="bolt"
      )
    ),
    title = "yono2844",
    skin = "light",
    url = "https://qiita.com/yono2844",
    src = "https://secure.gravatar.com/avatar/4f1b709d53f6d347a9b93e922b883ff3"
  ),
  body = bs4DashBody(),
  controlbar = bs4DashControlbar(),
  footer = bs4DashFooter(),
  title = "bs4Dash"
)

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

shinyApp(ui = ui, server = server)