My apologies. The style.css file is actually in the www folder for the example I provided, not at the ui.R level. However, no reference to "www/" is needed in theme =. Does that work for you?
Still doesn't work. It is a global reference, ok ?
I'm using
shinyUI(fluidPage
sidebarLayout
sidebarPanel
mainPanel
Could it be due to the hierarchy ? The file is in the same level as ui.
Below is a look at an example app (app.R), CSS file (styles.css), folder structure, and the resulting app. If you have separate server.R, ui.R, and/or global.R files, they would be at the app.R level.
app.R
library(shiny)
ui <- fluidPage(
theme = 'styles.css',
sidebarLayout(
sidebarPanel(
h2('This is my sidebar')
),
mainPanel(
h1("This is my app title!", align = "center")
)
)
)
server <- function(input, output) {}
shinyApp(ui, server)
styles.css
h1 {color: red;}
folder structure
- my_app_folder
| - app.R
| - www
| - styles.css
Here is a view of the resulting app, which applies the CSS styling.