3

I am looking for some way to display some Snap in the title bar just before the Name of my Shiny App ('My App') as below:

library(shiny)

ui = shinyUI(       
        fluidPage(title = "My App", 
            selectInput(inputId = "Pick", label = "Chose", choices = c('A', 'B', 'C'), selected = NULL, multiple = FALSE, selectize = TRUE, size = NULL, width = 300))
        )

server = function(input, output, session) {
    }

shinyApp(ui = ui, server = server)

I have tried with having HTML tag in the title argument as below, however it is not displaying anything.

library(shiny)

ui = shinyUI(       
        fluidPage(title = div(img(src = 'https://guidetoiceland.is/image/389003/x/0/the-beautiful-waterfalls-of-south-iceland-seljalandsfoss-skogafoss-amp-gljufrabui-1.jpg', "My App")), 
            selectInput(inputId = "Pick", label = "Chose", choices = c('A', 'B', 'C'), selected = NULL, multiple = FALSE, selectize = TRUE, size = NULL, width = 300))
        )

server = function(input, output, session) {
    }

shinyApp(ui = ui, server = server)

I would appreciate if someone guide me towards the right direction.

Thanks,

Bogaso
  • 2,838
  • 3
  • 24
  • 54
  • Hello I think you are going to find your answer here https://stackoverflow.com/questions/30096187/favicon-in-shiny. Possible duplicate of previously answered question – Billy34 Mar 26 '18 at 20:18
  • Hi Billy34, I am able to follow your link. Now I could display icon in Title. Thanks, – Bogaso Mar 26 '18 at 23:03

1 Answers1

1

This should do it:

library(shiny)

ui = shinyUI(fluidPage(
  # Application title
  titlePanel(
    title =
      tags$link(rel = "icon", type = "image/gif", href = "https://guidetoiceland.is/image/389003/x/0/the-beautiful-waterfalls-of-south-iceland-seljalandsfoss-skogafoss-amp-gljufrabui-1.jpg"),
    "My App"
  ),
  selectInput(
    inputId = "Pick",
    label = "Chose",
    choices = c('A', 'B', 'C'),
    selected = NULL,
    multiple = FALSE,
    selectize = TRUE,
    size = NULL,
    width = 300
  ))
)

server = function(input, output, session) {
}

shinyApp(ui = ui, server = server)

Unless I misunderstood your question here is the output. You have to open it in a browser to see it: enter image description here

Kill3rbee Lee Mtoti
  • 246
  • 1
  • 2
  • 11