Natasha R.
Natasha R.

Reputation: 531

Where should one place CSS stylesheets when using the reactable package?

I'm struggling to understand where to place CSS stylesheets when using the reactable package in R. I've read through much of the package's documentation, but it's not clear to me where to store stylesheets.

For example, I see that this example on the documentation page has a stylesheet section, but there's no indication where it should be stored so an R script can access it. I'm currently using RStudio's viewer to run code locally and make updates from there, but any CSS I add via a separate stylesheet fails to connect. I've created Shiny apps in the past that access stylesheets via a www folder in the project directory, but that's not working for me in this instance either.

I'm sure this is a straightforward fix, but I'm new to building webpages so I'm a bit in the dark.

Upvotes: 2

Views: 489

Answers (1)

yen
yen

Reputation: 2292

If this works similar to R Shiny projects, then:

  1. place your css file in the /www folder of your project, e.g. www/styles.css
  2. then make a reference to it in your R file:
tags$link(rel = "stylesheet", type = "text/css", href = "styles.css")

Upvotes: 1

Related Questions