Grafex lets you load external CSS files into a composition by listing them inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/andresilva-cc/grafex/llms.txt
Use this file to discover all available pages before exploring further.
config.css. The contents of each file are injected as <style> tags inside the HTML <head> before the page is rendered, so every rule you write is available to your JSX just as it would be in a browser. This works with any CSS that produces a plain .css file: hand-authored stylesheets, Tailwind’s compiled output, Sass output, or anything else.
Setting up CSS in config
Add acss array to your CompositionConfig. Each entry is a path to a .css file, resolved relative to the composition file:
./styles.css path is resolved relative to card.tsx. Any className you apply in JSX will pick up rules from that file exactly as if the stylesheet were loaded in a browser.
Multiple stylesheets
Pass multiple paths to load them all. They are injected in array order, so later files can override earlier ones:Using Tailwind CSS
Tailwind’s--watch mode pairs naturally with grafex dev. Compile your Tailwind input to a plain CSS file first, then point config.css at the output:
For live development, run Tailwind’s watcher and
grafex dev side by side. Grafex watches every file listed in config.css — when Tailwind rewrites styles.css, Grafex detects the change and re-renders within ~100ms:
Theming with htmlAttributes
CSS selectors that target the<html> element — like Tailwind v4’s :root[data-theme="dark"] — require the attribute to be present on the HTML root. Use config.htmlAttributes to set it:
<html data-theme="dark" lang="en">, so any CSS rule scoped to [data-theme="dark"] applies correctly. Attribute values are HTML-escaped automatically.
Per-variant theming
Variants can overridehtmlAttributes to switch themes without duplicating the composition file. In the example below, one export gets the light theme and another gets dark:
dark variant’s htmlAttributes are spread over the base attributes — only the keys you specify in the variant change; the rest are inherited.
The
css field is replaced (not merged) in variants. If your base config sets css: ['./base.css'] and a variant sets css: ['./dark.css'], that variant uses only dark.css. List every stylesheet the variant needs in its own css array.