Configure Frutjam to match your project's exact needs. The Tailwind plugin exposes options for setting default themes, defining custom color tokens, toggling the prefix system, and controlling which components are included so your output stays lean and intentional.
Basic Setup
Add Frutjam to your CSS file using the @plugin directive. No options are required — everything works out of the box.
Plugin Options
Customize Frutjam by passing options inside the @plugin block:
prefix
Adds a prefix to all Frutjam class names to avoid conflicts with your own CSS.
How prefix behaves depends on whether you also use Tailwind's prefix() option:
Frutjam prefix only
Frutjam class names are prefixed. Use them directly in HTML.
Tailwind prefix only
Tailwind's prefix() works as a variant — all utilities (including Frutjam's) require the prefix as a variant selector in HTML.
Both prefixes
Frutjam renames its classes (e.g. fj-btn), and Tailwind's variant prefix is required on top.
reset
Controls whether Frutjam injects base element resets (reboot styles). Defaults to true.
When true, Frutjam resets box model, typography, lists, media, and form elements — similar to Tailwind's preflight. When false, only the CSS variable tokens are injected; raw element styles are skipped entirely.
Set to false when you are already using another CSS framework (Bootstrap, Bulma, etc.) or your own reset, to avoid conflicts on elements like *, html, body, h1–h6, and button.
root
The CSS selector where Frutjam registers its design token variables (--color-primary, --color-base, etc.). Defaults to :root.
There are three useful values:
| Value | When to use |
:root | Default. Tokens are available globally across the whole page. |
:host | Shadow DOM / Web Components. Scopes tokens inside the component so they don't leak out. |
Any selector (e.g. #app) | Scopes tokens to a specific wrapper element. Useful when Frutjam coexists with another framework on the same page. |
Default — global tokens
Shadow DOM / Web Components
Scoped to a wrapper element
If another framework already controls :root (e.g. Bootstrap sets its own --bs-* variables and body colors), point Frutjam at a container element instead. This moves color, background-color, and all CSS variables off :root so they only apply inside that wrapper.
include
Load only specific components instead of the full library. Useful for reducing output size in production.
exclude
Load all components except the ones listed. Use when you only need to drop a few components from the full build.
Create a custom theme
To create your own theme, just assign your color values to the provided CSS variables within a [data-theme="your-theme-name"] selector
1. The "Automatic" Approach (Minimal)
In this version, we omit the --color-on-* variables. Frutjam detects the missing variables and calculates the optimal text color—usually flipping between a very light or very dark OKLCH value—to ensure the component remains accessible and readable.
2. The "Manual" Approach (Full Control)
In this version, we explicitly define the --color-on-* variables. This is ideal when you have specific brand guidelines (like using a tinted off-white instead of pure white) or when you want to achieve a specific "vibe," such as a low-contrast sophisticated look that still passes accessibility checks.
To apply your custom theme to your project in your HTML, use data-theme="your-theme-name" to an HTML element.
Themes can be nested—you can apply a specific theme to any section of your HTML, overriding the global theme for that area.