闪亮的仪表板标题

问题描述 投票:0回答:1

我是 Shiny 的初学者,我正在寻找开发我的第一个应用程序。我遇到了困难,因为我想在仪表板上添加一个顶部标题栏,在页面的左上角添加一个徽标和我的学习小组的名称,在右侧添加一个“停止应用程序”按钮。我希望得到一些帮助来实现如图所示的页面配置。

ui <- dashboardPage(
  dashboardHeader(title = "My first app"),
  dashboardSidebar(),
  dashboardBody()
)

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

shinyApp(ui = ui, server = server)

r shiny shinydashboard shinyapps
1个回答
0
投票

我们可以将

dashboardPage
包裹在 body 标签中以实现此目的:

library(shiny)
library(shinydashboard)

ui <- tags$body(
  tags$img(src = "https://www.r-project.org/logo/Rlogo.svg", width = '60px'),
  tags$span("My Team Name", style = "margin-left:25px;"),
  actionButton("mybutton", "My Button", icon = icon("plus"), style = "float:right; margin-top:5px; margin-right:5px"),
  dashboardPage(
    dashboardHeader(),
    dashboardSidebar(),
    dashboardBody()
  )
)

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

shinyApp(ui, server)

在这里您可以找到相关答案。

© www.soinside.com 2019 - 2024. All rights reserved.