@c15t/nextjs 2.0.0-rc.0 → 2.0.0-rc.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +10 -3
  2. package/client/components/consent-dialog-link.js +3 -0
  3. package/dist/headless.cjs +1 -1
  4. package/dist/iab/styles.css +12 -0
  5. package/dist/iab/styles.tw3.css +14 -0
  6. package/dist/index.cjs +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/libs/browser-initial-data.cjs +1 -0
  9. package/dist/libs/browser-initial-data.js +1 -0
  10. package/dist/libs/initial-data.cjs +1 -1
  11. package/dist/libs/initial-data.js +1 -1
  12. package/dist/styles.css +10 -0
  13. package/dist/styles.tw3.css +13 -0
  14. package/dist/types.cjs +1 -1
  15. package/dist/version.cjs +1 -1
  16. package/dist/version.js +1 -1
  17. package/{dist → dist-types}/headless.d.ts +0 -1
  18. package/{dist → dist-types}/index.d.ts +3 -2
  19. package/dist-types/libs/browser-initial-data.d.ts +9 -0
  20. package/{dist → dist-types}/libs/initial-data.d.ts +7 -2
  21. package/dist-types/types.d.ts +38 -0
  22. package/dist-types/version.d.ts +1 -0
  23. package/docs/README.md +73 -0
  24. package/docs/building-headless-components.md +377 -0
  25. package/docs/callbacks.md +184 -0
  26. package/docs/components/consent-banner.md +269 -0
  27. package/docs/components/consent-dialog-link.md +59 -0
  28. package/docs/components/consent-dialog-trigger.md +103 -0
  29. package/docs/components/consent-dialog.md +177 -0
  30. package/docs/components/consent-manager-provider.md +425 -0
  31. package/docs/components/consent-widget.md +133 -0
  32. package/docs/components/dev-tools.md +63 -0
  33. package/docs/components/frame.md +73 -0
  34. package/docs/concepts/client-modes.md +175 -0
  35. package/docs/concepts/consent-categories.md +97 -0
  36. package/docs/concepts/consent-models.md +116 -0
  37. package/docs/concepts/cookie-management.md +122 -0
  38. package/docs/concepts/glossary.md +23 -0
  39. package/docs/concepts/initialization-flow.md +148 -0
  40. package/docs/concepts/policy-packs.md +229 -0
  41. package/docs/headless.md +190 -0
  42. package/docs/hooks/use-color-scheme.md +40 -0
  43. package/docs/hooks/use-consent-manager/checking-consent.md +94 -0
  44. package/docs/hooks/use-consent-manager/location-info.md +95 -0
  45. package/docs/hooks/use-consent-manager/overview.md +420 -0
  46. package/docs/hooks/use-consent-manager/setting-consent.md +92 -0
  47. package/docs/hooks/use-draggable.md +57 -0
  48. package/docs/hooks/use-focus-trap.md +41 -0
  49. package/docs/hooks/use-reduced-motion.md +35 -0
  50. package/docs/hooks/use-ssr-status.md +31 -0
  51. package/docs/hooks/use-text-direction.md +49 -0
  52. package/docs/hooks/use-translations.md +118 -0
  53. package/docs/iab/consent-banner.md +94 -0
  54. package/docs/iab/consent-dialog.md +134 -0
  55. package/docs/iab/overview.md +126 -0
  56. package/docs/iab/use-gvl-data.md +20 -0
  57. package/docs/iframe-blocking.md +107 -0
  58. package/docs/integrations/building-integrations.md +405 -0
  59. package/docs/integrations/databuddy.md +203 -0
  60. package/docs/integrations/google-tag-manager.md +153 -0
  61. package/docs/integrations/google-tag.md +122 -0
  62. package/docs/integrations/linkedin-insights.md +109 -0
  63. package/docs/integrations/meta-pixel.md +342 -0
  64. package/docs/integrations/microsoft-uet.md +112 -0
  65. package/docs/integrations/overview.md +105 -0
  66. package/docs/integrations/posthog.md +199 -0
  67. package/docs/integrations/tiktok-pixel.md +113 -0
  68. package/docs/integrations/x-pixel.md +143 -0
  69. package/docs/internationalization.md +197 -0
  70. package/docs/network-blocker.md +178 -0
  71. package/docs/optimization.md +234 -0
  72. package/docs/policy-packs.md +246 -0
  73. package/docs/quickstart.md +161 -0
  74. package/docs/script-loader.md +321 -0
  75. package/docs/server-side.md +176 -0
  76. package/docs/styling/classnames.md +92 -0
  77. package/docs/styling/color-scheme.md +82 -0
  78. package/docs/styling/css-variables.md +92 -0
  79. package/docs/styling/overview.md +456 -0
  80. package/docs/styling/slots.md +127 -0
  81. package/docs/styling/tailwind.md +113 -0
  82. package/docs/styling/tokens.md +216 -0
  83. package/docs/troubleshooting.md +146 -0
  84. package/iab/styles.css +1 -0
  85. package/package.json +38 -17
  86. package/readme.json +4 -0
  87. package/src/iab/styles.css +12 -0
  88. package/src/iab/styles.tw3.css +14 -0
  89. package/src/styles.css +10 -0
  90. package/src/styles.tw3.css +13 -0
  91. package/styles.css +1 -0
  92. package/dist/headless.d.ts.map +0 -1
  93. package/dist/index.d.ts.map +0 -1
  94. package/dist/libs/initial-data.d.ts.map +0 -1
  95. package/dist/types.d.ts +0 -16
  96. package/dist/types.d.ts.map +0 -1
  97. package/dist/version.d.ts +0 -2
  98. package/dist/version.d.ts.map +0 -1
@@ -0,0 +1,456 @@
1
+ ---
2
+ title: Styling Overview
3
+ description: Five approaches for theming consent components — design tokens, component slots, CSS variables, className, and noStyle mode.
4
+ ---
5
+ c15t's theming system gives you multiple levels of control, but most customization should stay inside the pre-built components.
6
+
7
+ Start with the lowest-power tool that solves the problem:
8
+
9
+ 1. **Pre-built component APIs** — provider options and component props such as `layout`, `direction`, `primaryButton`, `legalLinks`, and `theme.consentActions`
10
+ 2. **Design tokens** — global colors, typography, spacing, radius, shadows, and motion
11
+ 3. **Slots** — targeted styling for specific parts such as the banner card, footer, or title
12
+ 4. **CSS variables or className-level overrides** — when you need to integrate with external CSS systems
13
+ 5. **Compound components** — when you must rearrange markup while still using c15t primitives
14
+ 6. **`noStyle`** — when you want c15t structure but you need to own all visual styling
15
+ 7. **Headless** — when you want fully custom markup and behavior
16
+
17
+ Keep styling and escalation as separate decisions:
18
+
19
+ * If you are still using the stock banner, dialog, or widget, stay with props, tokens, and slots.
20
+ * Escalate to compound components, `noStyle`, or headless only when the structure or behavior itself must change.
21
+
22
+ ## Styling Approaches
23
+
24
+ |Approach|Control|Use When|
25
+ |--|--|--|
26
+ |**Component and provider APIs**|High|Reordering actions, changing button emphasis, configuring links, hiding branding, changing copy via `i18n`|
27
+ |**Tokens**|High|Changing global colors, typography, spacing, radius, shadows, or motion|
28
+ |**Slots**|Medium|Targeting specific component parts (for example `consentBannerFooter` or `consentDialogCard`)|
29
+ |**CSS variables / className**|Medium|Integrating with an existing stylesheet or utility classes after tokens and slots|
30
+ |**Compound components**|Structure|Rearranging existing c15t primitives without going fully custom|
31
+ |**noStyle**|Full visuals|Keeping c15t structure but replacing all visual defaults|
32
+ |**Headless**|Full|Replacing both markup and behavior|
33
+
34
+ ## Quick Start
35
+
36
+ ```tsx
37
+ import { type Theme, ConsentManagerProvider, ConsentBanner, ConsentDialog } from '@c15t/nextjs';
38
+
39
+ const theme = {
40
+ colors: {
41
+ primary: '#6366f1',
42
+ primaryHover: '#4f46e5',
43
+ },
44
+ radius: {
45
+ md: '0.75rem',
46
+ lg: '1rem',
47
+ },
48
+ slots: {
49
+ consentBannerTitle: 'text-xl font-semibold',
50
+ buttonPrimary: 'rounded-full',
51
+ },
52
+ } satisfies Theme;
53
+
54
+ export function ConsentManager({ children }) {
55
+ return (
56
+ <ConsentManagerProvider
57
+ options={{
58
+ mode: 'hosted',
59
+ backendURL: '/api/c15t',
60
+ theme,
61
+ }}
62
+ >
63
+ <ConsentBanner />
64
+ <ConsentDialog />
65
+ {children}
66
+ </ConsentManagerProvider>
67
+ );
68
+ }
69
+ ```
70
+
71
+ ## Styling Inside Pre-Built Components
72
+
73
+ Start here before you consider compound components or headless mode.
74
+
75
+ ### 1. Provider and component configuration
76
+
77
+ Use the stock APIs first:
78
+
79
+ * `layout`, `direction`, and `primaryButton` for banner action arrangement
80
+ * `legalLinks` for link visibility
81
+ * `hideBranding` and `showTrigger` for dialog and widget behavior
82
+ * `theme.consentActions` for stock banner and dialog button treatment
83
+ * `i18n` on `ConsentManagerProvider` for copy changes
84
+
85
+ ```tsx
86
+ <ConsentBanner layout={['customize', ['reject', 'accept']]} primaryButton="accept" />
87
+ ```
88
+
89
+ ### 2. Design tokens
90
+
91
+ Set global values for colors, typography, spacing, radius, shadows, and motion:
92
+
93
+ ```tsx
94
+ options={{ theme: { colors: { primary: '#6366f1' } } }}
95
+ ```
96
+
97
+ Use tokens first when the change is semantic:
98
+
99
+ * Banner card background -> `theme.colors.surface`
100
+ * Banner footer background -> `theme.colors.surfaceHover`
101
+ * Shared copy color -> `theme.colors.text` and `theme.colors.textMuted`
102
+ * Primary-filled surfaces such as stock branding tags and filled actions -> `theme.colors.primary` with `theme.colors.textOnPrimary` as the matching foreground override
103
+
104
+ ```tsx
105
+ options={{
106
+ theme: {
107
+ colors: {
108
+ surface: '#ffffff',
109
+ surfaceHover: '#f6f3ee',
110
+ },
111
+ },
112
+ }}
113
+ ```
114
+
115
+ 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.
116
+
117
+ ### 3. Component slots
118
+
119
+ Target specific component parts via the `slots` object:
120
+
121
+ ```tsx
122
+ options={{
123
+ theme: {
124
+ slots: {
125
+ consentBannerCard: 'rounded-[28px] shadow-xl',
126
+ consentBannerFooter: 'border-t border-black/10',
127
+ consentBannerTitle: 'tracking-tight',
128
+ },
129
+ },
130
+ }}
131
+ ```
132
+
133
+ Use slots when the component part is right but the local styling needs adjustment.
134
+
135
+ ### 4. CSS variables and className-level overrides
136
+
137
+ Override `--c15t-*` custom properties in your stylesheet or attach classes through slots when your app styling is driven externally.
138
+
139
+ Reach for this after tokens and slots, not before.
140
+
141
+ ```tsx
142
+ options={{
143
+ theme: {
144
+ slots: {
145
+ consentBannerFooter: 'bg-[var(--banner-footer)]',
146
+ },
147
+ },
148
+ }}
149
+ ```
150
+
151
+ ## Escalating Beyond Pre-Built Components
152
+
153
+ Only move up this ladder when the lower rung cannot satisfy the request.
154
+
155
+ ### 5. Compound components
156
+
157
+ Use compound components when you need to rearrange existing c15t primitives:
158
+
159
+ ```tsx
160
+ <ConsentBanner.Root>
161
+ <ConsentBanner.Card>
162
+ <ConsentBanner.Header>
163
+ <ConsentBanner.Title />
164
+ <ConsentBanner.Description />
165
+ </ConsentBanner.Header>
166
+ <ConsentBanner.Footer>
167
+ <ConsentBanner.CustomizeButton />
168
+ <ConsentBanner.FooterSubGroup>
169
+ <ConsentBanner.RejectButton />
170
+ <ConsentBanner.AcceptButton />
171
+ </ConsentBanner.FooterSubGroup>
172
+ </ConsentBanner.Footer>
173
+ </ConsentBanner.Card>
174
+ </ConsentBanner.Root>
175
+ ```
176
+
177
+ ### 6. `noStyle`
178
+
179
+ Use `noStyle` only when the c15t structure is still correct but you want to replace all visual defaults:
180
+
181
+ ```tsx
182
+ <ConsentBanner noStyle />
183
+ ```
184
+
185
+ ### 7. Headless
186
+
187
+ Go headless only when you are replacing both markup and behavior. For that path, continue to [Headless Mode](../headless).
188
+
189
+ ## Common Styling Tasks
190
+
191
+ ### Change the banner footer background
192
+
193
+ ```tsx
194
+ options={{
195
+ theme: {
196
+ colors: {
197
+ surfaceHover: '#f6f3ee',
198
+ },
199
+ },
200
+ }}
201
+ ```
202
+
203
+ Use `theme.colors.surfaceHover` before trying raw CSS.
204
+
205
+ ### Change the banner card background
206
+
207
+ ```tsx
208
+ options={{
209
+ theme: {
210
+ colors: {
211
+ surface: '#fffdf8',
212
+ },
213
+ },
214
+ }}
215
+ ```
216
+
217
+ Use `theme.colors.surface` before overriding banner CSS variables directly.
218
+
219
+ ### Tweak the banner card, footer, or title styling without changing markup
220
+
221
+ ```tsx
222
+ options={{
223
+ theme: {
224
+ slots: {
225
+ consentBannerCard: 'rounded-[28px] shadow-xl',
226
+ consentBannerFooter: 'border-t border-black/10 px-6',
227
+ consentBannerTitle: 'text-xl tracking-tight',
228
+ },
229
+ },
230
+ }}
231
+ ```
232
+
233
+ ### Change stock consent action button styles semantically
234
+
235
+ ```tsx
236
+ options={{
237
+ theme: {
238
+ consentActions: {
239
+ default: { mode: 'stroke' },
240
+ accept: { variant: 'primary', mode: 'stroke' },
241
+ customize: { variant: 'neutral', mode: 'ghost' },
242
+ },
243
+ },
244
+ }}
245
+ ```
246
+
247
+ 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`.
248
+
249
+ ### Change banner copy without replacing the component
250
+
251
+ ```tsx
252
+ options={{
253
+ i18n: {
254
+ locale: 'en',
255
+ messages: {
256
+ en: {
257
+ cookieBanner: {
258
+ title: 'We value your privacy',
259
+ description: 'We use cookies to improve the site and measure performance.',
260
+ },
261
+ common: {
262
+ acceptAll: 'Accept all',
263
+ rejectAll: 'Reject all',
264
+ customize: 'Manage preferences',
265
+ },
266
+ },
267
+ },
268
+ },
269
+ }}
270
+ ```
271
+
272
+ ### Enable dark mode safely
273
+
274
+ ```tsx
275
+ options={{
276
+ colorScheme: 'system',
277
+ theme: {
278
+ colors: { surface: '#ffffff', text: '#1f2937' },
279
+ dark: { surface: '#111827', text: '#f9fafb' },
280
+ },
281
+ }}
282
+ ```
283
+
284
+ > ℹ️ **Info:**
285
+ > 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.
286
+ >
287
+ > ⚠️ **Warning:**
288
+ > Do not jump to CSS overrides or !important because a token did not appear to work at first glance.noStyle: true removes 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 .dark and .c15t-dark.
289
+
290
+ ## API Reference
291
+
292
+ ### Theme
293
+
294
+ |Property|Type|Description|Default|Required|
295
+ |:--|:--|:--|:--|:--:|
296
+ |colors|ColorTokens \|undefined|Color palette for light mode.|-|Optional|
297
+ |dark|ColorTokens \|undefined|Dark mode color overrides.|-|Optional|
298
+ |typography|TypographyTokens \|undefined|Typography settings for text elements.|-|Optional|
299
+ |spacing|SpacingTokens \|undefined|Spacing scale for internal padding and margins.|-|Optional|
300
+ |radius|RadiusTokens \|undefined|Border radius scale for rounded corners.|-|Optional|
301
+ |shadows|ShadowTokens \|undefined|Box shadow scale for depth and elevation.|-|Optional|
302
+ |motion|MotionTokens \|undefined|Animation and transition timing.|-|Optional|
303
+ |consentActions|Object \|undefined|Semantic button styling for consent actions.|-|Optional|
304
+ |slots|ComponentSlots \|undefined|Component-specific style overrides.|-|Optional|
305
+
306
+ #### `colors` ColorTokens
307
+
308
+ Color palette for light mode.
309
+
310
+ |Property|Type|Description|Default|Required|
311
+ |:--|:--|:--|:--|:--:|
312
+ |primary|string \|undefined|Primary brand/accent color for interactive elements.|-|Optional|
313
+ |primaryHover|string \|undefined|Hover/active state for primary elements.|-|Optional|
314
+ |surface|string \|undefined|Main background color for panels and containers.|-|Optional|
315
+ |surfaceHover|string \|undefined|Hover state for surface elements.|-|Optional|
316
+ |border|string \|undefined|Border color for containers and inputs.|-|Optional|
317
+ |borderHover|string \|undefined|Hover state for bordered elements.|-|Optional|
318
+ |text|string \|undefined|Primary text color for headings and body.|-|Optional|
319
+ |textMuted|string \|undefined|Muted text color for secondary content.|-|Optional|
320
+ |textOnPrimary|string \|undefined|Text color for content on primary background. Auto-derived from \`primary\` when omitted.|-|Optional|
321
+ |overlay|string \|undefined|Overlay color for modal backdrops.|-|Optional|
322
+ |switchTrack|string \|undefined|Toggle track color (off state).|-|Optional|
323
+ |switchTrackActive|string \|undefined|Toggle track color (on state).|-|Optional|
324
+ |switchThumb|string \|undefined|Toggle thumb color.|-|Optional|
325
+
326
+ #### `dark` ColorTokens
327
+
328
+ Dark mode color overrides.
329
+
330
+ |Property|Type|Description|Default|Required|
331
+ |:--|:--|:--|:--|:--:|
332
+ |primary|string \|undefined|Primary brand/accent color for interactive elements.|-|Optional|
333
+ |primaryHover|string \|undefined|Hover/active state for primary elements.|-|Optional|
334
+ |surface|string \|undefined|Main background color for panels and containers.|-|Optional|
335
+ |surfaceHover|string \|undefined|Hover state for surface elements.|-|Optional|
336
+ |border|string \|undefined|Border color for containers and inputs.|-|Optional|
337
+ |borderHover|string \|undefined|Hover state for bordered elements.|-|Optional|
338
+ |text|string \|undefined|Primary text color for headings and body.|-|Optional|
339
+ |textMuted|string \|undefined|Muted text color for secondary content.|-|Optional|
340
+ |textOnPrimary|string \|undefined|Text color for content on primary background. Auto-derived from \`primary\` when omitted.|-|Optional|
341
+ |overlay|string \|undefined|Overlay color for modal backdrops.|-|Optional|
342
+ |switchTrack|string \|undefined|Toggle track color (off state).|-|Optional|
343
+ |switchTrackActive|string \|undefined|Toggle track color (on state).|-|Optional|
344
+ |switchThumb|string \|undefined|Toggle thumb color.|-|Optional|
345
+
346
+ #### `typography` TypographyTokens
347
+
348
+ Typography settings for text elements.
349
+
350
+ |Property|Type|Description|Default|Required|
351
+ |:--|:--|:--|:--|:--:|
352
+ |fontFamily|string \|undefined|Font family for all components.|-|Optional|
353
+ |fontSize|Object \|undefined|Font sizes for text hierarchy.|-|Optional|
354
+ |fontWeight|Object \|undefined|Font weights for emphasis.|-|Optional|
355
+ |lineHeight|Object \|undefined|Line heights for readability.|-|Optional|
356
+
357
+ #### `spacing` SpacingTokens
358
+
359
+ Spacing scale for internal padding and margins.
360
+
361
+ |Property|Type|Description|Default|Required|
362
+ |:--|:--|:--|:--|:--:|
363
+ |xs|string \|undefined|@default '0.25rem' (4px)|-|Optional|
364
+ |sm|string \|undefined|@default '0.5rem' (8px)|-|Optional|
365
+ |md|string \|undefined|@default '1rem' (16px)|-|Optional|
366
+ |lg|string \|undefined|@default '1.5rem' (24px)|-|Optional|
367
+ |xl|string \|undefined|@default '2rem' (32px)|-|Optional|
368
+
369
+ #### `radius` RadiusTokens
370
+
371
+ Border radius scale for rounded corners.
372
+
373
+ |Property|Type|Description|Default|Required|
374
+ |:--|:--|:--|:--|:--:|
375
+ |sm|string \|undefined|@default '0.25rem' (4px)|-|Optional|
376
+ |md|string \|undefined|@default '0.5rem' (8px)|-|Optional|
377
+ |lg|string \|undefined|@default '0.75rem' (12px)|-|Optional|
378
+ |full|string \|undefined|@default '9999px'|-|Optional|
379
+
380
+ #### `shadows` ShadowTokens
381
+
382
+ Box shadow scale for depth and elevation.
383
+
384
+ |Property|Type|Description|Default|Required|
385
+ |:--|:--|:--|:--|:--:|
386
+ |sm|string \|undefined|@default '0 1px 2px hsla(0, 0%, 0%, 0.05)'|-|Optional|
387
+ |md|string \|undefined|@default '0 4px 12px hsla(0, 0%, 0%, 0.08)'|-|Optional|
388
+ |lg|string \|undefined|@default '0 8px 24px hsla(0, 0%, 0%, 0.12)'|-|Optional|
389
+
390
+ #### `motion` MotionTokens
391
+
392
+ Animation and transition timing.
393
+
394
+ |Property|Type|Description|Default|Required|
395
+ |:--|:--|:--|:--|:--:|
396
+ |duration|Object \|undefined|Duration presets for transitions.|-|Optional|
397
+ |easing|string \|undefined|Default CSS easing function for general animation curves.|-|Optional|
398
+ |easingOut|string \|undefined|CSS easing function for enter/exit animations. Use for modals, tooltips, dropdowns, and any element entering or exiting.|-|Optional|
399
+ |easingInOut|string \|undefined|CSS easing function for on-screen movement. Use when elements already on screen need to move or morph.|-|Optional|
400
+ |easingSpring|string \|undefined|CSS easing function with spring-like overshoot. Use for playful, bouncy animations.|-|Optional|
401
+
402
+ #### `consentActions`
403
+
404
+ Semantic button styling for consent actions.
405
+
406
+ |Property|Type|Description|Default|Required|
407
+ |:--|:--|:--|:--|:--:|
408
+ |default|ConsentActionStyle \|undefined|-|-|Optional|
409
+ |accept|ConsentActionStyle \|undefined|-|-|Optional|
410
+ |reject|ConsentActionStyle \|undefined|-|-|Optional|
411
+ |customize|ConsentActionStyle \|undefined|-|-|Optional|
412
+
413
+ #### `slots` ComponentSlots
414
+
415
+ Component-specific style overrides.
416
+
417
+ |Property|Type|Description|Default|Required|
418
+ |:--|:--|:--|:--|:--:|
419
+ |consentBanner|SlotStyle \|undefined|Root wrapper for the consent banner portal content.|-|Optional|
420
+ |consentBannerCard|SlotStyle \|undefined|Main card container for banner content and actions.|-|Optional|
421
+ |consentBannerHeader|SlotStyle \|undefined|Header region containing title and description.|-|Optional|
422
+ |consentBannerTitle|SlotStyle \|undefined|Banner title text element.|-|Optional|
423
+ |consentBannerDescription|SlotStyle \|undefined|Banner description text element.|-|Optional|
424
+ |consentBannerFooter|SlotStyle \|undefined|Footer container for banner action buttons.|-|Optional|
425
+ |consentBannerFooterSubGroup|SlotStyle \|undefined|Nested button group inside the banner footer.|-|Optional|
426
+ |consentBannerTag|SlotStyle \|undefined|Branding tag rendered above the consent banner card.|-|Optional|
427
+ |consentBannerOverlay|SlotStyle \|undefined|Backdrop overlay rendered behind the banner when enabled.|-|Optional|
428
+ |consentDialog|SlotStyle \|undefined|Root wrapper for the consent dialog modal.|-|Optional|
429
+ |consentDialogCard|SlotStyle \|undefined|Main dialog card container.|-|Optional|
430
+ |consentDialogHeader|SlotStyle \|undefined|Dialog header region containing title and description.|-|Optional|
431
+ |consentDialogTitle|SlotStyle \|undefined|Dialog title text element.|-|Optional|
432
+ |consentDialogDescription|SlotStyle \|undefined|Dialog description text element.|-|Optional|
433
+ |consentDialogContent|SlotStyle \|undefined|Dialog content region (typically holds ConsentWidget).|-|Optional|
434
+ |consentDialogFooter|SlotStyle \|undefined|Footer container used by compound dialog layouts.|-|Optional|
435
+ |consentDialogTag|SlotStyle \|undefined|Branding tag rendered below the stock consent dialog card.|-|Optional|
436
+ |consentDialogOverlay|SlotStyle \|undefined|Backdrop overlay rendered behind the dialog.|-|Optional|
437
+ |consentWidget|SlotStyle \|undefined|Root wrapper for the consent widget/preferences panel.|-|Optional|
438
+ |consentWidgetAccordion|SlotStyle \|undefined|Accordion region listing consent categories.|-|Optional|
439
+ |consentWidgetFooter|SlotStyle \|undefined|Footer area for widget actions and links.|-|Optional|
440
+ |consentWidgetTag|SlotStyle \|undefined|Branding tag rendered below the standalone consent widget.|-|Optional|
441
+ |frame|SlotStyle \|undefined|Frame wrapper used by blocking placeholders (e.g., iframe blocking).|-|Optional|
442
+ |iabConsentBanner|SlotStyle \|undefined|Root wrapper for the IAB consent banner.|-|Optional|
443
+ |iabConsentBannerCard|SlotStyle \|undefined|Main card container for IAB banner content.|-|Optional|
444
+ |iabConsentBannerHeader|SlotStyle \|undefined|Header region for IAB banner title/description.|-|Optional|
445
+ |iabConsentBannerFooter|SlotStyle \|undefined|Footer container for IAB banner actions.|-|Optional|
446
+ |iabConsentBannerTag|SlotStyle \|undefined|Branding tag rendered above the IAB banner card.|-|Optional|
447
+ |iabConsentBannerOverlay|SlotStyle \|undefined|Backdrop overlay rendered behind the IAB banner.|-|Optional|
448
+ |iabConsentDialog|SlotStyle \|undefined|Root wrapper for the IAB consent dialog.|-|Optional|
449
+ |iabConsentDialogCard|SlotStyle \|undefined|Main card container for IAB dialog content.|-|Optional|
450
+ |iabConsentDialogHeader|SlotStyle \|undefined|Header region for IAB dialog title/description.|-|Optional|
451
+ |iabConsentDialogFooter|SlotStyle \|undefined|Footer container for IAB dialog actions.|-|Optional|
452
+ |iabConsentDialogTag|SlotStyle \|undefined|Branding tag rendered below the IAB dialog card.|-|Optional|
453
+ |iabConsentDialogOverlay|SlotStyle \|undefined|Backdrop overlay rendered behind the IAB dialog.|-|Optional|
454
+ |buttonPrimary|SlotStyle \|undefined|Shared primary button style used across consent components.|-|Optional|
455
+ |buttonSecondary|SlotStyle \|undefined|Shared secondary button style used across consent components.|-|Optional|
456
+ |toggle|SlotStyle \|undefined|Shared toggle/switch style used for category controls.|-|Optional|
@@ -0,0 +1,127 @@
1
+ ---
2
+ title: Component Slots
3
+ description: Target individual component parts with styles using the slot system - className strings or inline style objects.
4
+ ---
5
+ ## What are Slots?
6
+
7
+ Slots let you target specific parts of consent components with styles. Each component is built from named slots such as `consentBannerTitle` and `consentDialogTag`.
8
+
9
+ Use slots after the stock component APIs and design tokens:
10
+
11
+ * If the change is semantic, prefer tokens first. For example, the stock banner footer background comes from `theme.colors.surfaceHover`.
12
+ * If the component part is correct but you need a local tweak, use a slot.
13
+
14
+ Common banner slot choices:
15
+
16
+ * `consentBannerCard` for card radius, shadow, width, and local background treatment
17
+ * `consentBannerFooter` for spacing, borders, and local footer styling
18
+ * `consentBannerTitle` for title typography
19
+ * `buttonPrimary` and `buttonSecondary` for shared button classes
20
+
21
+ ## Using Slots
22
+
23
+ Pass slot styles in the theme's `slots` object:
24
+
25
+ ```tsx
26
+ const theme = {
27
+ slots: {
28
+ consentBannerFooter: 'border-t border-black/10 px-6',
29
+ consentBannerTitle: 'text-xl font-bold tracking-tight',
30
+
31
+ // Object value = className + inline styles
32
+ consentBannerCard: {
33
+ className: 'rounded-xl shadow-lg',
34
+ style: { maxWidth: '600px' },
35
+ },
36
+ },
37
+ } satisfies Theme;
38
+ ```
39
+
40
+ ## Slot Style Types
41
+
42
+ Each slot accepts either a `string` (treated as className) or a `SlotStyle` object:
43
+
44
+ ```tsx
45
+ // String: treated as className
46
+ consentBannerTitle: 'my-custom-class'
47
+
48
+ // Object: className + style + noStyle
49
+ consentBannerFooter: {
50
+ className: 'border-t border-black/10',
51
+ style: { paddingBlock: '1rem' },
52
+ noStyle: false, // Set true only when you want to remove this slot's default styling
53
+ }
54
+ ```
55
+
56
+ `noStyle` on a slot is an advanced escape hatch. Start with className and style overrides first.
57
+
58
+ ## Example: Style the stock banner without changing markup
59
+
60
+ ```tsx
61
+ const theme = {
62
+ colors: {
63
+ surface: '#fffdf8',
64
+ surfaceHover: '#f6f3ee',
65
+ },
66
+ slots: {
67
+ consentBannerCard: 'rounded-[28px] shadow-xl',
68
+ consentBannerFooter: 'border-t border-black/10 px-6',
69
+ consentBannerTitle: 'tracking-tight',
70
+ },
71
+ } satisfies Theme;
72
+ ```
73
+
74
+ ## Available Slots
75
+
76
+ Use the typed API reference below for the full slot list and descriptions. It stays in sync with the actual component slot surface.
77
+
78
+ ## API Reference
79
+
80
+ ### ComponentSlots
81
+
82
+ |Property|Type|Description|Default|Required|
83
+ |:--|:--|:--|:--|:--:|
84
+ |consentBanner|SlotStyle \|undefined|Root wrapper for the consent banner portal content.|-|Optional|
85
+ |consentBannerCard|SlotStyle \|undefined|Main card container for banner content and actions.|-|Optional|
86
+ |consentBannerHeader|SlotStyle \|undefined|Header region containing title and description.|-|Optional|
87
+ |consentBannerTitle|SlotStyle \|undefined|Banner title text element.|-|Optional|
88
+ |consentBannerDescription|SlotStyle \|undefined|Banner description text element.|-|Optional|
89
+ |consentBannerFooter|SlotStyle \|undefined|Footer container for banner action buttons.|-|Optional|
90
+ |consentBannerFooterSubGroup|SlotStyle \|undefined|Nested button group inside the banner footer.|-|Optional|
91
+ |consentBannerTag|SlotStyle \|undefined|Branding tag rendered above the consent banner card.|-|Optional|
92
+ |consentBannerOverlay|SlotStyle \|undefined|Backdrop overlay rendered behind the banner when enabled.|-|Optional|
93
+ |consentDialog|SlotStyle \|undefined|Root wrapper for the consent dialog modal.|-|Optional|
94
+ |consentDialogCard|SlotStyle \|undefined|Main dialog card container.|-|Optional|
95
+ |consentDialogHeader|SlotStyle \|undefined|Dialog header region containing title and description.|-|Optional|
96
+ |consentDialogTitle|SlotStyle \|undefined|Dialog title text element.|-|Optional|
97
+ |consentDialogDescription|SlotStyle \|undefined|Dialog description text element.|-|Optional|
98
+ |consentDialogContent|SlotStyle \|undefined|Dialog content region (typically holds ConsentWidget).|-|Optional|
99
+ |consentDialogFooter|SlotStyle \|undefined|Footer container used by compound dialog layouts.|-|Optional|
100
+ |consentDialogTag|SlotStyle \|undefined|Branding tag rendered below the stock consent dialog card.|-|Optional|
101
+ |consentDialogOverlay|SlotStyle \|undefined|Backdrop overlay rendered behind the dialog.|-|Optional|
102
+ |consentWidget|SlotStyle \|undefined|Root wrapper for the consent widget/preferences panel.|-|Optional|
103
+ |consentWidgetAccordion|SlotStyle \|undefined|Accordion region listing consent categories.|-|Optional|
104
+ |consentWidgetFooter|SlotStyle \|undefined|Footer area for widget actions and links.|-|Optional|
105
+ |consentWidgetTag|SlotStyle \|undefined|Branding tag rendered below the standalone consent widget.|-|Optional|
106
+ |frame|SlotStyle \|undefined|Frame wrapper used by blocking placeholders (e.g., iframe blocking).|-|Optional|
107
+ |iabConsentBanner|SlotStyle \|undefined|Root wrapper for the IAB consent banner.|-|Optional|
108
+ |iabConsentBannerCard|SlotStyle \|undefined|Main card container for IAB banner content.|-|Optional|
109
+ |iabConsentBannerHeader|SlotStyle \|undefined|Header region for IAB banner title/description.|-|Optional|
110
+ |iabConsentBannerFooter|SlotStyle \|undefined|Footer container for IAB banner actions.|-|Optional|
111
+ |iabConsentBannerTag|SlotStyle \|undefined|Branding tag rendered above the IAB banner card.|-|Optional|
112
+ |iabConsentBannerOverlay|SlotStyle \|undefined|Backdrop overlay rendered behind the IAB banner.|-|Optional|
113
+ |iabConsentDialog|SlotStyle \|undefined|Root wrapper for the IAB consent dialog.|-|Optional|
114
+ |iabConsentDialogCard|SlotStyle \|undefined|Main card container for IAB dialog content.|-|Optional|
115
+ |iabConsentDialogHeader|SlotStyle \|undefined|Header region for IAB dialog title/description.|-|Optional|
116
+ |iabConsentDialogFooter|SlotStyle \|undefined|Footer container for IAB dialog actions.|-|Optional|
117
+ |iabConsentDialogTag|SlotStyle \|undefined|Branding tag rendered below the IAB dialog card.|-|Optional|
118
+ |iabConsentDialogOverlay|SlotStyle \|undefined|Backdrop overlay rendered behind the IAB dialog.|-|Optional|
119
+ |buttonPrimary|SlotStyle \|undefined|Shared primary button style used across consent components.|-|Optional|
120
+ |buttonSecondary|SlotStyle \|undefined|Shared secondary button style used across consent components.|-|Optional|
121
+ |toggle|SlotStyle \|undefined|Shared toggle/switch style used for category controls.|-|Optional|
122
+
123
+ ### SlotStyle
124
+
125
+ |Property|Type|Description|Default|Required|
126
+ |:--|:--|:--|:--|:--:|
127
+ |SlotStyle|SlotStyle|Type alias for SlotStyle|-|✅ Required|
@@ -0,0 +1,113 @@
1
+ ---
2
+ title: Tailwind CSS
3
+ description: Use Tailwind CSS utility classes to style consent components via the slot system.
4
+ ---
5
+ c15t works with Tailwind CSS out of the box. Use the `slots` theme option to apply Tailwind utility classes to any component part.
6
+
7
+ ## Setup
8
+
9
+ Import the standard c15t stylesheet once in your app-level CSS entrypoint:
10
+
11
+ ```css
12
+ /* React: src/index.css */
13
+ @import "@c15t/react/styles.css";
14
+
15
+ /* Next.js: app/globals.css */
16
+ @import "@c15t/nextjs/styles.css";
17
+ ```
18
+
19
+ Keeping the c15t stylesheet in your global CSS entrypoint makes layer and cascade order explicit. JS/TSX side-effect imports can load in a different order across framework and Tailwind tooling, which makes style regressions harder to debug.
20
+
21
+ ### Tailwind v4
22
+
23
+ Tailwind v4 automatically scans your source files. Import Tailwind normally, then place the c15t stylesheet immediately after it. c15t component styles join Tailwind's `components` layer automatically, so no extra c15t-specific layer declaration is needed:
24
+
25
+ ```css title="src/index.css"
26
+ @import "tailwindcss";
27
+ @import "@c15t/react/styles.css";
28
+ ```
29
+
30
+ ```css title="app/globals.css"
31
+ @import "tailwindcss";
32
+ @import "@c15t/nextjs/styles.css";
33
+ ```
34
+
35
+ ### Tailwind v3
36
+
37
+ Import the Tailwind 3-compatible c15t stylesheet after `@tailwind components;` and before `@tailwind utilities;`:
38
+
39
+ ```css title="src/index.css"
40
+ @tailwind base;
41
+ @tailwind components;
42
+ @import "@c15t/react/styles.tw3.css";
43
+ @tailwind utilities;
44
+ ```
45
+
46
+ ```css title="app/globals.css"
47
+ @tailwind base;
48
+ @tailwind components;
49
+ @import "@c15t/nextjs/styles.tw3.css";
50
+ @tailwind utilities;
51
+ ```
52
+
53
+ ## Using Tailwind with Slots
54
+
55
+ Apply Tailwind classes via the theme's `slots` object:
56
+
57
+ ```tsx
58
+ import { type ReactNode } from 'react';
59
+ import { type Theme, ConsentManagerProvider } from '@c15t/nextjs';
60
+
61
+ const theme = {
62
+ slots: {
63
+ consentBanner: 'fixed bottom-0 inset-x-0 z-50',
64
+ consentBannerCard: 'mx-auto max-w-2xl rounded-t-2xl bg-white p-6 shadow-2xl',
65
+ consentBannerTitle: 'text-lg font-semibold text-gray-900',
66
+ consentBannerDescription: 'mt-2 text-sm text-gray-600',
67
+ consentBannerFooter: 'mt-4 flex flex-wrap gap-3',
68
+ buttonPrimary: 'rounded-full bg-indigo-600 px-6 py-2.5 text-sm font-medium text-white hover:bg-indigo-700',
69
+ buttonSecondary: 'rounded-full border border-gray-300 px-6 py-2.5 text-sm font-medium text-gray-700 hover:bg-gray-50',
70
+ toggle: 'data-[state=checked]:bg-indigo-600',
71
+ },
72
+ } satisfies Theme;
73
+
74
+ export function ConsentManager({ children }: { children: ReactNode }) {
75
+ return (
76
+ <ConsentManagerProvider options={{ theme, mode: 'hosted', backendURL: '/api/c15t' }}>
77
+ {children}
78
+ </ConsentManagerProvider>
79
+ );
80
+ }
81
+ ```
82
+
83
+ ## Dark Mode with Tailwind
84
+
85
+ Combine Tailwind's dark mode with c15t's `dark` tokens:
86
+
87
+ ```tsx
88
+ const theme = {
89
+ colors: {
90
+ primary: '#6366f1',
91
+ surface: '#ffffff',
92
+ text: '#1f2937',
93
+ },
94
+ dark: {
95
+ primary: '#818cf8',
96
+ surface: '#1f2937',
97
+ text: '#f9fafb',
98
+ },
99
+ slots: {
100
+ consentBannerCard: 'bg-white dark:bg-gray-900 shadow-lg dark:shadow-gray-900/30',
101
+ consentBannerTitle: 'text-gray-900 dark:text-gray-100',
102
+ },
103
+ } satisfies Theme;
104
+ ```
105
+
106
+ ## Optional: noStyle Mode
107
+
108
+ If you want Tailwind to own all layout and visual styling, use `noStyle: true`.
109
+
110
+ > ℹ️ **Info:**
111
+ > When using noStyle: true with Tailwind, you're responsible for all layout and visual styling. Start with slots first, then switch to noStyle only when you need full control.
112
+
113
+ For full custom markup (not just styles), see [Headless Mode](../headless).