BaşlayınÜcretsiz Başlayın

Setting a sidebar

The sidebar can be likened to a list of available courses or meals in a restaurant.

In the sidebar, you can add a menu using sidebarMenu(), in which you can add several buttons that can link you to different dashboard pages using menuItem(). You also saw that the usual inputs and outputs can be added to the sidebar. What are the objects that could be useful in the sidebar of dashboard showcasing soccer data?

In this example, you will practice adding some of these objects to your dashboard sidebar.

The shiny and shinydashboard packages have already been loaded for you. Furthermore, the dashboard header has already been stored as header.

Bu egzersiz

Building Dashboards with shinydashboard

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

sidebar <- dashboardSidebar(
  # Set up a sidebar menu with width 400
  ___(
    width = ___,
    id = "pages",
 	# Add a tab button called "Match details"
    ___(___, tabName = "matches", icon = ___,
             badgeLabel = "New content!", badgeColor = ___)
  )
)

body <- dashboardBody()
ui <- dashboardPage(header, sidebar, body)
server <- function(input, output){}
shinyApp(ui, server)
Kodu Düzenle ve Çalıştır