firmo23
firmo23

Reputation: 8464

Change the font inside tags in a shiny app

How can I set the font in a text in a shiny app? Should I change it for every tags$ or is there a generic way?

## app.R ##
library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(

  ),
  dashboardBody(

  )
)

server <- function(input, output) { 
  tags$h3(style="color:black","font-family:Calibri", "Text")
  }

shinyApp(ui, server)

this is sample of the part that I want to edit:

output$tabers<-renderUI({
    if(input$sec=="Introduction"){
      tabsetPanel(id="I",type="tabs",tabPanel("Start", id = "StartHR",
                           tags$br(),
                           img(src='Alpha-Architect.png', align = "center",height="100%", width="50%"),


                           tags$br(),
                           tags$br(),

                           tags$h3(style="color:black", "About this Dashboard"),
                           br(),

                           p(style="text-align:justify; color:black;'",'Produced by',a("Alpha Architect.", 
                                                                                      href = "https://alphaarchitect.com"),"and",a("RStudio.", 
                                                                                                                                   href = "http://www.reproduciblefinance.com/")),
                           #br(),
                           br(),
                           p(style="text-align:justify; color:black;'",'Please read our full disclosures',a("here", 
                                                                                                            href = "https://alphaarchitect.com/disclosures")),

Upvotes: 1

Views: 730

Answers (1)

Yifu Yan
Yifu Yan

Reputation: 6116

Why do you write it in server?

To globally apply styles, you need to add styles in head of HTML.

Add this as your dashboard body:

dashboardBody(
    tags$head(
        tags$style("h3 {font-family:Calibri}")
    )
)

Upvotes: 1

Related Questions