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:

  1. Define tokens (colors, spacing, radius, etc.) in JavaScript
  2. Tokens are injected as CSS custom properties (--c15t-*) at runtime
  3. Components consume these variables in their default styles
  4. You override at any level: tokens, slots, CSS variables, or raw classNames

Styling Approaches

ApproachControlUse When
TokensHighChanging global colors, typography, spacing, radius, shadows, or motion
SlotsMediumTargeting specific component parts (e.g., the banner title, dialog footer)
CSS VariablesMediumOverriding --c15t-* variables from external CSS
classNameMediumPassing class names to components or slots
noStyleFullRemoving 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: true removes 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 .dark and .c15t-dark.

API Reference

Loading…