Styling Overview
Customize every aspect of c15t's consent components using design tokens, component slots, and CSS variables.
c15t's theming system gives you multiple levels of control, from high-level design tokens to complete style removal.
The flow:
- Define tokens (colors, spacing, radius, etc.) in JavaScript
- Tokens are injected as CSS custom properties (
--c15t-*) at runtime - Components consume these variables in their default styles
- You override at any level: tokens, slots, CSS variables, or raw classNames
Styling Approaches
| Approach | Control | Use When |
|---|---|---|
| Tokens | High | Changing global colors, typography, spacing, radius, shadows, or motion |
| Slots | Medium | Targeting specific component parts (e.g., the banner title, dialog footer) |
| CSS Variables | Medium | Overriding --c15t-* variables from external CSS |
| className | Medium | Passing class names to components or slots |
| noStyle | Full | Removing all default styles, building from scratch |
Quick Start
Use the Theme type for TypeScript autocomplete and validation:
Styling Paths
1. Design tokens
Set global values for colors, typography, spacing, radius, shadows, and motion:
2. Component slots
Target specific component parts via the slots object:
3. CSS variables
Override --c15t-* custom properties in your stylesheet.
4. className prop
Pass className directly to components:
5. noStyle prop
Strip all default styles and build from scratch (best paired with Headless Mode):
Common Styling Tasks
Change brand color globally
Make the banner card more compact
Round primary/secondary buttons
Enable dark mode safely
Info
noStyle: trueremoves layout and visual defaults. Use it only when you want full control.- Use either tokens/slots or raw CSS variable overrides intentionally to avoid conflicting style sources.
- For dark mode, c15t supports
.darkand.c15t-dark.
API Reference
Loading…