bs4Dash
bs4Dash copied to clipboard
How to write a title for the app in dashboardHeader > leftUI ?
In the previous version of dashboardHeaderPlus the following code worked, now I get this error:
Error in tagAssert(item, type = "li", class = "dropdown") : Expected tag to be of type li
App:
library(shiny)
library(bs4Dash)
shinyApp(
ui = dashboardPage(
title = "Basic Dashboard",
header = dashboardHeader(
title = dashboardBrand(
title = "bs4Dash",
color = "primary",
href = "https://www.google.fr",
image = "https://adminlte.io/themes/AdminLTE/dist/img/user2-160x160.jpg",
),
leftUi = tagList(
tags$p("Title of the app",
style = "font-family: Arial,sans-serif; font-size: 120%; color: #ffffff;")
)
),
sidebar = dashboardSidebar(),
body = dashboardBody()
),
server = function(input, output) {}
)
How can I add a title for the app in the leftUI part of the header?
Best regards.
Hi,
The title must be provided in the title
or dashboardBrand
slot.
Hi @DivadNojnarg, so is it not possible to have the following lay-out with {bs4Dash}
? Sometimes the titles are too long for the header area and the leftui area is better.
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
shinyApp(
ui = dashboardPage(
header = dashboardHeader(
title = "my logo",
leftUi = tagList(tags$p("MY TITLE",
style = "font-family: Arial,sans-serif; font-size: 162%; color: #ffffff;"))
),
sidebar = dashboardSidebar(),
body = dashboardBody(),
title = "DashboardPage"
),
server = function(input, output) { }
)
btw i´m loving the new version! 🚀
I found a way to do it using the .list
argument. It´s a bit hacky but kind of works:
library(shiny)
library(bs4Dash)
shinyApp(
ui = bs4Dash::dashboardPage(
header = bs4Dash::dashboardHeader(
title = dashboardBrand(
title = HTML(paste0(
'<span class = "d-none d-lg-block">
<img src = "https://image.flaticon.com/icons/svg/204/204074.svg"; width="50%"; style = "margin: auto auto auto; display: block;">
</span>',
'<span class = "d-lg-none">
<img src= "https://image.flaticon.com/icons/svg/207/207074.svg"; width="25%"; style = "margin: auto auto auto; display: block;>
</span>'
))
),
.list = "My Title"
),
sidebar = bs4DashSidebar(),
body = bs4Dash::dashboardBody(),
title = "DashboardPage"
),
server = function(input, output) { }
)
Hi, this works for me:
ui = dashboardPage(
header = dashboardHeader(
tags$h4(icon("line-chart"),"Title")