Styling Overview
c15t's theming system gives you multiple levels of control, but most customization should stay inside the pre-built components.
Start with the lowest-power tool that solves the problem:
- Pre-built component APIs — provider options and component props such as
layout,direction,primaryButton,legalLinks, andtheme.consentActions - Design tokens — global colors, typography, spacing, radius, shadows, and motion
- Slots — targeted styling for specific parts such as the banner card, footer, or title
- CSS variables or className-level overrides — when you need to integrate with external CSS systems
- Compound components — when you must rearrange markup while still using c15t primitives
noStyle— when you want c15t structure but you need to own all visual styling- Headless — when you want fully custom markup and behavior
Keep styling and escalation as separate decisions:
- If you are still using the stock banner, dialog, or widget, stay with props, tokens, and slots.
- Escalate to compound components,
noStyle, or headless only when the structure or behavior itself must change.
Styling Approaches
| Approach | Control | Use When |
|---|---|---|
| Component and provider APIs | High | Reordering actions, changing button emphasis, configuring links, hiding branding, changing copy via i18n |
| Tokens | High | Changing global colors, typography, spacing, radius, shadows, or motion |
| Slots | Medium | Targeting specific component parts (for example consentBannerFooter or consentDialogCard) |
| CSS variables / className | Medium | Integrating with an existing stylesheet or utility classes after tokens and slots |
| Compound components | Structure | Rearranging existing c15t primitives without going fully custom |
| noStyle | Full visuals | Keeping c15t structure but replacing all visual defaults |
| Headless | Full | Replacing both markup and behavior |
Quick Start
Styling Inside Pre-Built Components
Start here before you consider compound components or headless mode.
1. Provider and component configuration
Use the stock APIs first:
layout,direction, andprimaryButtonfor banner action arrangementlegalLinksfor link visibilityhideBrandingandshowTriggerfor dialog and widget behaviortheme.consentActionsfor stock banner and dialog button treatmenti18nonConsentManagerProviderfor copy changes
2. Design tokens
Set global values for colors, typography, spacing, radius, shadows, and motion:
Use tokens first when the change is semantic:
- Banner card background ->
theme.colors.surface - Banner footer background ->
theme.colors.surfaceHover - Shared copy color ->
theme.colors.textandtheme.colors.textMuted - Primary-filled surfaces such as stock branding tags and filled actions ->
theme.colors.primarywiththeme.colors.textOnPrimaryas the matching foreground override
If you set theme.colors.primary but omit theme.colors.textOnPrimary, c15t derives a readable foreground automatically. Add textOnPrimary only when you need to force a specific branded foreground color.
3. Component slots
Target specific component parts via the slots object:
Use slots when the component part is right but the local styling needs adjustment.
4. CSS variables and className-level overrides
Override --c15t-* custom properties in your stylesheet or attach classes through slots when your app styling is driven externally.
Reach for this after tokens and slots, not before.
Escalating Beyond Pre-Built Components
Only move up this ladder when the lower rung cannot satisfy the request.
5. Compound components
Use compound components when you need to rearrange existing c15t primitives:
6. noStyle
Use noStyle only when the c15t structure is still correct but you want to replace all visual defaults:
7. Headless
Go headless only when you are replacing both markup and behavior. For that path, continue to Headless Mode.
Common Styling Tasks
Change the banner footer background
Use theme.colors.surfaceHover before trying raw CSS.
Change the banner card background
Use theme.colors.surface before overriding banner CSS variables directly.
Tweak the banner card, footer, or title styling without changing markup
Change stock consent action button styles semantically
Use theme.consentActions when you want to change the stock banner/dialog button treatment without rewriting the component layout. Policy packs still control action arrangement and primary-action hints. The theme controls whether those actions render as stroke, filled, ghost, or lighter.
Change banner copy without replacing the component
Enable dark mode safely
Info
If a token change does not show up where you expect, check how that component maps tokens to CSS variables before escalating. For example, the stock banner footer background comes from colors.surfaceHover, not a separate footer token.
Info
- Do not jump to CSS overrides or
!importantbecause a token did not appear to work at first glance. noStyle: trueremoves layout and visual defaults. Treat it as an advanced opt-out, not a normal theming step.- Headless mode is for replacing markup and behavior, not for styling-only requests.
- Use either tokens/slots or raw CSS variable overrides intentionally to avoid conflicting style sources.
- For dark mode, c15t supports
.darkand.c15t-dark.