Home > Net >  Shinydashboard, align logo to the right
Shinydashboard, align logo to the right

Time:05-28

Is it possible to move the logo in the header completely to the right side? I have attached a pic how I would like it to look like. here is a MWE

logo to the right

library(shiny)
library(shinydashboard)

ui <- function(){

dashboardPage(
    dashboardHeader(title = tags$a(href = 'https://google.com',
                                           tags$img(src = 'https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png', height= 50,width= 50, align = "right"),
                                           'Title')),
  dashboardSidebar( sidebarMenu(id="side", menuItem("Option1", tabName="op1"),

                                menuItem("Option2", tabName="op2"))
),


  body=dashboardBody())}


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

shinyApp(ui, server)

CodePudding user response:

You could wrap it in a li wrapper of class dropdown. Try this

library(shiny)
library(shinydashboard)

ui <- function(){
  
  dashboardPage(
    dashboardHeader(
      title = "Demo",
      tags$li(class = "dropdown",
              tags$a(href = 'https://google.com',
                     tags$img(src = 'https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png', height= 50,width= 50, align = "right")
              )
      ),
      dropdownMenuOutput('messageMenu')
    ),
    dashboardSidebar( sidebarMenu(id="side", menuItem("Option1", tabName="op1"),
                                  
                                  menuItem("Option2", tabName="op2"))
    ),
    
    
    body=dashboardBody())}


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

shinyApp(ui, server)
  • Related