Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dashboardBrand issues #386

Closed
onmyojiyys opened this issue Dec 20, 2024 · 2 comments
Closed

dashboardBrand issues #386

onmyojiyys opened this issue Dec 20, 2024 · 2 comments
Labels
question Further information is requested

Comments

@onmyojiyys
Copy link

I want to replace the image in dashboardBrand with a local logo picture, but it doesn't seem to work. I'm sure that there is no problem with the relative path between the picture and app.R. Could you please tell me how to use local png pictures in dashboardBrand?
header = dashboardHeader( title = dashboardBrand( title = "bs4Dash", color = "primary", href = "https://www.google.fr", image = "./images/logo.png" ), skin = "light", status = "white", border = TRUE, sidebarIcon = icon("bars"), controlbarIcon = icon("th"), fixed = FALSE, leftUi = tagList( dropdownMenu( badgeStatus = "info", type = "notifications", notificationItem( inputId = "triggerAction2", text = "Error!", status = "danger" ) ), dropdownMenu( badgeStatus = "info", type = "tasks", taskItem( inputId = "triggerAction3", text = "My progress", color = "orange", value = 10 ) ) ), rightUi = dropdownMenu( badgeStatus = "danger", type = "messages", messageItem( inputId = "triggerAction1", message = "message 1", from = "Divad Nojnarg", image = "https://adminlte.io/themes/v3/dist/img/user3-128x128.jpg", time = "today", color = "lime" ) ) )

image

@DivadNojnarg DivadNojnarg added the question Further information is requested label Dec 20, 2024
@DivadNojnarg
Copy link
Member

Hi,

That's probably because the image you point to isn't available on the server for the Shiny app. You have to tell shiny about this, for instance you can use shiny::addResourcePath("assets/images", "<PATH_TO_IMAGES>") to tell shiny to serve the PATH_TO_IMAGES folder at assets/images. Then you can use assets/images to point to different images in you Shiny app code:

library(shiny)
library(bs4Dash)
library(fresh)

shiny::addResourcePath("assets/images", "<PATH_TO_IMAGES>")

  shinyApp(
    ui = dashboardPage(
      options = NULL,
      header = dashboardHeader(
        title = dashboardBrand(
          title = "My dashboard",
          color = "primary",
          href = "https://adminlte.io/themes/v3",
          image = "assets/images/<IMAGE_FILE>"
        )
      ),
      sidebar = dashboardSidebar(),
      body = dashboardBody(
        box(status = "danger"),
        box(status = "primary"),
        box(status = "orange")
      ),
      controlbar = dashboardControlbar(),
      title = "DashboardPage"
    ),
    server = function(input, output) { }
  )

@onmyojiyys
Copy link
Author

Thanks!I fixed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants