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

How to change the title color in shinydashboard from server using shinyjs #368

Open
yikeshu0611 opened this issue Sep 27, 2021 · 1 comment

Comments

@yikeshu0611
Copy link

Great thanks for you. The shiny dashboard is so greate.
I want to change the title color of the titlex
It not works bellow

library(shinydashboard)
library(shiny)
library(shinyjs)
header <- dashboardHeader(title='want to be red') |> 
  tagAppendAttributes(id='nn',.cssSelector = 'span')

side <- dashboardSidebar(
)

body <- dashboardBody(
  useShinyjs()
)

ui <- dashboardPage(header,side,body,title = 'nhanesR')

server <- function(input, output, session){
  runjs('$("#nn > span").css("color", "red")')
}
shinyApp(ui,server)
@ismirsehregal
Copy link

No need for shinyjs

library(shinydashboard)
library(shiny)

ui <- dashboardPage(dashboardHeader(title = div('want to be red', style = "color: red;")),
                dashboardSidebar(),
                dashboardBody(),
                title = 'nhanesR')

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

shinyApp(ui, server)

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

No branches or pull requests

2 participants