5

I'm using shinydashboard, and I want to put an image in the title with the following code:

header <- dashboardHeader(
  title = div(img(src = 'logo.png',
                  height = 60,
                  width = 120))
)

Everything goes well, but when I open the app by chrome, in my browser's tag, it looks very weird like below.

enter image description here

Is there any way to keep this from showing on the browser and show some normal text?

<div> <img src="logo.png" height="60" width="120"/>
rankthefirst
  • 1,370
  • 2
  • 14
  • 26

3 Answers3

3

Since you're overwriting Dashboard's Title, You've to explicitly mention the page title with tags$title

tags$title('This is my page')

For shinydashboard:

ui <- dashboardPage(title = 'This is my title', header, sidebar, body, skin='red')
amrrs
  • 6,215
  • 2
  • 18
  • 27
  • but where should I put the `tags$title`, I'm using shinydashboard, it shows "Expected tag to be of type li", when I put it in the `dashboardHeader`; it doesn't work when I put it in `dashboardBody`. – rankthefirst Oct 04 '17 at 09:14
0

The best solution could be the following:

header <- dashboardHeader(
    title = HTML('<div> <img src="logo.png" height="60" width="120"/>')
)
Vishal Sharma
  • 289
  • 2
  • 10
0

Old thread, but there is now in 2022 an argument windowTitle to titlePanel

titlePanel(title, windowTitle = title)

So it is simply a case of supplying that, as in the following where the tab gets its own text string:

`titlePanel(
title=htmltools::div(
    htmltools::img(
    src="Transparent Logo No Slogan.png",style="width:50px; height:50px"),
    "my application title"
 ),
 windowTitle = "my tab title"
 )`
Gerry
  • 113
  • 7