@c15t/scripts 3.0.0-alpha.2 → 3.0.0-alpha.4

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 (300) hide show
  1. package/AGENTS.md +129 -63
  2. package/README.md +8 -29
  3. package/SKILL.md +33 -0
  4. package/dist/adobe-analytics.js +2 -0
  5. package/dist/ahrefs-analytics.js +2 -0
  6. package/dist/amplitude.js +2 -0
  7. package/dist/clearbit.js +2 -0
  8. package/dist/cloudflare-web-analytics.js +2 -0
  9. package/dist/cloudflare-zaraz.js +2 -0
  10. package/dist/crisp.js +2 -0
  11. package/dist/databuddy.js +2 -0
  12. package/dist/e2e-test-utils.js +2 -139
  13. package/dist/engine/compile.js +2 -89
  14. package/dist/engine/runtime.js +2 -448
  15. package/dist/events.js +2 -218
  16. package/dist/fathom-analytics.js +2 -0
  17. package/dist/front-chat.js +2 -0
  18. package/dist/google-tag-manager.js +2 -0
  19. package/dist/google-tag.js +2 -0
  20. package/dist/heap.js +2 -0
  21. package/dist/hightouch.js +2 -0
  22. package/dist/hotjar.js +2 -0
  23. package/dist/intercom.js +2 -0
  24. package/dist/klaviyo.js +2 -0
  25. package/dist/linkedin-insights.js +2 -0
  26. package/dist/logrocket.js +2 -0
  27. package/dist/matomo-analytics.js +2 -0
  28. package/dist/meta-pixel.js +2 -0
  29. package/dist/microsoft-clarity.js +2 -0
  30. package/dist/microsoft-uet.js +2 -0
  31. package/dist/mixpanel-analytics.js +2 -0
  32. package/dist/one-dollar-stats.js +2 -0
  33. package/dist/openai-pixel.js +2 -0
  34. package/dist/pinterest-tag.js +2 -0
  35. package/dist/pirsch.js +2 -0
  36. package/dist/plausible-analytics.js +2 -0
  37. package/dist/posthog.js +2 -0
  38. package/dist/promptwatch.js +2 -0
  39. package/dist/reddit-pixel.js +2 -0
  40. package/dist/registry.js +2 -422
  41. package/dist/resolve.js +2 -33
  42. package/dist/rudderstack.js +2 -0
  43. package/dist/rybbit-analytics.js +2 -0
  44. package/dist/segment.js +2 -0
  45. package/dist/snapchat-pixel.js +2 -0
  46. package/dist/tiktok-pixel.js +2 -0
  47. package/dist/types.js +2 -16
  48. package/dist/umami-analytics.js +2 -0
  49. package/dist/vendors/_shared/attributes.js +2 -14
  50. package/dist/vendors/_shared/google-consent.js +2 -27
  51. package/dist/vendors/_shared/install-builders.js +2 -21
  52. package/dist/vendors/_shared/required-id.js +2 -0
  53. package/dist/vendors/_shared/script-url.js +2 -28
  54. package/dist/vendors/ads-and-pixels/linkedin-insights.js +2 -48
  55. package/dist/vendors/ads-and-pixels/meta-pixel.js +2 -153
  56. package/dist/vendors/ads-and-pixels/microsoft-uet.js +2 -110
  57. package/dist/vendors/ads-and-pixels/openai-pixel.js +2 -88
  58. package/dist/vendors/ads-and-pixels/pinterest-tag.js +2 -123
  59. package/dist/vendors/ads-and-pixels/reddit-pixel.js +2 -107
  60. package/dist/vendors/ads-and-pixels/snapchat-pixel.js +2 -87
  61. package/dist/vendors/ads-and-pixels/tiktok-pixel.js +2 -89
  62. package/dist/vendors/ads-and-pixels/x-pixel.js +2 -48
  63. package/dist/vendors/analytics/adobe-analytics.js +2 -49
  64. package/dist/vendors/analytics/ahrefs-analytics.js +2 -27
  65. package/dist/vendors/analytics/amplitude.js +2 -134
  66. package/dist/vendors/analytics/clearbit.js +2 -28
  67. package/dist/vendors/analytics/cloudflare-web-analytics.js +2 -32
  68. package/dist/vendors/analytics/databuddy.js +2 -103
  69. package/dist/vendors/analytics/fathom-analytics.js +2 -35
  70. package/dist/vendors/analytics/google-tag.js +2 -78
  71. package/dist/vendors/analytics/heap.js +2 -134
  72. package/dist/vendors/analytics/hightouch.js +2 -109
  73. package/dist/vendors/analytics/hotjar.js +2 -44
  74. package/dist/vendors/analytics/logrocket.js +2 -58
  75. package/dist/vendors/analytics/matomo-analytics.js +2 -191
  76. package/dist/vendors/analytics/microsoft-clarity.js +2 -100
  77. package/dist/vendors/analytics/mixpanel-analytics.js +2 -93
  78. package/dist/vendors/analytics/one-dollar-stats.js +2 -30
  79. package/dist/vendors/analytics/pirsch.js +2 -67
  80. package/dist/vendors/analytics/plausible-analytics.js +2 -81
  81. package/dist/vendors/analytics/posthog.js +2 -200
  82. package/dist/vendors/analytics/promptwatch.js +2 -29
  83. package/dist/vendors/analytics/rudderstack.js +2 -183
  84. package/dist/vendors/analytics/rybbit-analytics.js +2 -63
  85. package/dist/vendors/analytics/segment.js +2 -65
  86. package/dist/vendors/analytics/umami-analytics.js +2 -39
  87. package/dist/vendors/analytics/vercel-analytics.js +2 -53
  88. package/dist/vendors/email-and-sms/klaviyo.js +2 -0
  89. package/dist/vendors/functional/crisp.js +2 -100
  90. package/dist/vendors/functional/front-chat.js +2 -64
  91. package/dist/vendors/functional/intercom.js +2 -45
  92. package/dist/vendors/tag-managers/cloudflare-zaraz.js +2 -98
  93. package/dist/vendors/tag-managers/google-tag-manager.js +2 -73
  94. package/dist/vercel-analytics.js +2 -0
  95. package/dist/x-pixel.js +2 -0
  96. package/dist-types/adobe-analytics.d.ts +2 -0
  97. package/dist-types/ahrefs-analytics.d.ts +2 -0
  98. package/dist-types/amplitude.d.ts +2 -0
  99. package/dist-types/clearbit.d.ts +2 -0
  100. package/dist-types/cloudflare-web-analytics.d.ts +2 -0
  101. package/dist-types/cloudflare-zaraz.d.ts +2 -0
  102. package/dist-types/crisp.d.ts +2 -0
  103. package/dist-types/databuddy.d.ts +2 -0
  104. package/dist-types/e2e-test-utils.d.ts +2 -0
  105. package/dist-types/engine/compile.d.ts +2 -3
  106. package/dist-types/engine/runtime.d.ts +2 -3
  107. package/dist-types/events.d.ts +2 -46
  108. package/dist-types/fathom-analytics.d.ts +2 -0
  109. package/dist-types/front-chat.d.ts +2 -0
  110. package/dist-types/google-tag-manager.d.ts +2 -0
  111. package/dist-types/google-tag.d.ts +2 -0
  112. package/dist-types/heap.d.ts +2 -0
  113. package/dist-types/hightouch.d.ts +2 -0
  114. package/dist-types/hotjar.d.ts +2 -0
  115. package/dist-types/intercom.d.ts +2 -0
  116. package/dist-types/klaviyo.d.ts +2 -0
  117. package/dist-types/linkedin-insights.d.ts +2 -0
  118. package/dist-types/logrocket.d.ts +2 -0
  119. package/dist-types/matomo-analytics.d.ts +2 -0
  120. package/dist-types/meta-pixel.d.ts +2 -0
  121. package/dist-types/microsoft-clarity.d.ts +2 -0
  122. package/dist-types/microsoft-uet.d.ts +2 -0
  123. package/dist-types/mixpanel-analytics.d.ts +2 -0
  124. package/dist-types/one-dollar-stats.d.ts +2 -0
  125. package/dist-types/openai-pixel.d.ts +2 -0
  126. package/dist-types/pinterest-tag.d.ts +2 -0
  127. package/dist-types/pirsch.d.ts +2 -0
  128. package/dist-types/plausible-analytics.d.ts +2 -0
  129. package/dist-types/posthog.d.ts +2 -0
  130. package/dist-types/promptwatch.d.ts +2 -0
  131. package/dist-types/reddit-pixel.d.ts +2 -0
  132. package/dist-types/registry.d.ts +2 -485
  133. package/dist-types/resolve.d.ts +2 -9
  134. package/dist-types/rudderstack.d.ts +2 -0
  135. package/dist-types/rybbit-analytics.d.ts +2 -0
  136. package/dist-types/segment.d.ts +2 -0
  137. package/dist-types/snapchat-pixel.d.ts +2 -0
  138. package/dist-types/tiktok-pixel.d.ts +2 -0
  139. package/dist-types/types.d.ts +2 -314
  140. package/dist-types/umami-analytics.d.ts +2 -0
  141. package/dist-types/vendors/_shared/attributes.d.ts +2 -35
  142. package/dist-types/vendors/_shared/google-consent.d.ts +2 -47
  143. package/dist-types/vendors/_shared/install-builders.d.ts +2 -30
  144. package/dist-types/vendors/_shared/required-id.d.ts +2 -0
  145. package/dist-types/vendors/_shared/script-url.d.ts +2 -75
  146. package/dist-types/vendors/ads-and-pixels/linkedin-insights.d.ts +2 -92
  147. package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +2 -289
  148. package/dist-types/vendors/ads-and-pixels/microsoft-uet.d.ts +2 -105
  149. package/dist-types/vendors/ads-and-pixels/openai-pixel.d.ts +2 -211
  150. package/dist-types/vendors/ads-and-pixels/pinterest-tag.d.ts +2 -295
  151. package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +2 -210
  152. package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +2 -171
  153. package/dist-types/vendors/ads-and-pixels/tiktok-pixel.d.ts +2 -106
  154. package/dist-types/vendors/ads-and-pixels/x-pixel.d.ts +2 -183
  155. package/dist-types/vendors/analytics/adobe-analytics.d.ts +2 -75
  156. package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +2 -62
  157. package/dist-types/vendors/analytics/amplitude.d.ts +2 -234
  158. package/dist-types/vendors/analytics/clearbit.d.ts +2 -60
  159. package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +2 -67
  160. package/dist-types/vendors/analytics/databuddy.d.ts +2 -147
  161. package/dist-types/vendors/analytics/fathom-analytics.d.ts +2 -90
  162. package/dist-types/vendors/analytics/google-tag.d.ts +2 -95
  163. package/dist-types/vendors/analytics/heap.d.ts +2 -316
  164. package/dist-types/vendors/analytics/hightouch.d.ts +2 -285
  165. package/dist-types/vendors/analytics/hotjar.d.ts +2 -73
  166. package/dist-types/vendors/analytics/logrocket.d.ts +2 -101
  167. package/dist-types/vendors/analytics/matomo-analytics.d.ts +2 -41
  168. package/dist-types/vendors/analytics/microsoft-clarity.d.ts +2 -97
  169. package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +2 -113
  170. package/dist-types/vendors/analytics/one-dollar-stats.d.ts +2 -39
  171. package/dist-types/vendors/analytics/pirsch.d.ts +2 -96
  172. package/dist-types/vendors/analytics/plausible-analytics.d.ts +2 -122
  173. package/dist-types/vendors/analytics/posthog.d.ts +2 -175
  174. package/dist-types/vendors/analytics/promptwatch.d.ts +2 -36
  175. package/dist-types/vendors/analytics/rudderstack.d.ts +2 -330
  176. package/dist-types/vendors/analytics/rybbit-analytics.d.ts +2 -82
  177. package/dist-types/vendors/analytics/segment.d.ts +2 -164
  178. package/dist-types/vendors/analytics/umami-analytics.d.ts +2 -93
  179. package/dist-types/vendors/analytics/vercel-analytics.d.ts +2 -66
  180. package/dist-types/vendors/email-and-sms/klaviyo.d.ts +2 -0
  181. package/dist-types/vendors/functional/crisp.d.ts +2 -78
  182. package/dist-types/vendors/functional/front-chat.d.ts +2 -62
  183. package/dist-types/vendors/functional/intercom.d.ts +2 -135
  184. package/dist-types/vendors/tag-managers/cloudflare-zaraz.d.ts +2 -39
  185. package/dist-types/vendors/tag-managers/google-tag-manager.d.ts +2 -96
  186. package/dist-types/vercel-analytics.d.ts +2 -0
  187. package/dist-types/x-pixel.d.ts +2 -0
  188. package/docs/README.md +129 -63
  189. package/docs/assets/v3/bottom-bar.png +0 -0
  190. package/docs/assets/v3/brand-card.png +0 -0
  191. package/docs/assets/v3/brand-preferences.png +0 -0
  192. package/docs/assets/v3/choice-wall.png +0 -0
  193. package/docs/assets/v3/headless-bar-html.png +0 -0
  194. package/docs/assets/v3/headless-bar-mobile.png +0 -0
  195. package/docs/assets/v3/headless-bar.png +0 -0
  196. package/docs/assets/v3/slim-bar.png +0 -0
  197. package/docs/concepts/choose-your-setup.md +87 -0
  198. package/docs/concepts/consent-categories.md +84 -0
  199. package/docs/{guides → concepts}/consent-state.md +89 -105
  200. package/docs/{guides → concepts}/data-fetching.md +31 -27
  201. package/docs/concepts/how-consent-works.md +123 -0
  202. package/docs/concepts/policies.md +71 -0
  203. package/docs/customization/class-names.md +202 -0
  204. package/docs/customization/dark-mode.md +157 -0
  205. package/docs/customization/motion.md +119 -0
  206. package/docs/customization/overview.md +67 -34
  207. package/docs/customization/recipes.md +839 -49
  208. package/docs/customization/slots.md +216 -35
  209. package/docs/customization/stylesheets.md +147 -0
  210. package/docs/customization/tailwind.md +842 -0
  211. package/docs/customization/tokens.md +163 -96
  212. package/docs/customization/translations.md +60 -3
  213. package/docs/frameworks/astro/embeds.md +160 -0
  214. package/docs/frameworks/astro/network-blocker.md +86 -0
  215. package/docs/frameworks/astro/scripts.md +155 -0
  216. package/docs/frameworks/html/embeds.md +142 -0
  217. package/docs/frameworks/html/network-blocker.md +105 -0
  218. package/docs/frameworks/html/scripts.md +164 -0
  219. package/docs/frameworks/javascript/scripts.md +137 -0
  220. package/docs/frameworks/next/embeds.md +90 -0
  221. package/docs/frameworks/next/network-blocker.md +153 -0
  222. package/docs/frameworks/next/scripts.md +196 -0
  223. package/docs/frameworks/nuxt/embeds.md +81 -0
  224. package/docs/frameworks/nuxt/network-blocker.md +97 -0
  225. package/docs/frameworks/nuxt/scripts.md +89 -0
  226. package/docs/frameworks/react/embeds.md +89 -0
  227. package/docs/frameworks/react/network-blocker.md +140 -0
  228. package/docs/frameworks/react/scripts.md +115 -0
  229. package/docs/frameworks/svelte/embeds.md +96 -0
  230. package/docs/frameworks/svelte/network-blocker.md +141 -0
  231. package/docs/frameworks/svelte/scripts.md +144 -0
  232. package/docs/frameworks/sveltekit/embeds.md +103 -0
  233. package/docs/frameworks/sveltekit/network-blocker.md +159 -0
  234. package/docs/frameworks/sveltekit/scripts.md +172 -0
  235. package/docs/frameworks/tanstack-start/embeds.md +96 -0
  236. package/docs/frameworks/tanstack-start/network-blocker.md +145 -0
  237. package/docs/frameworks/tanstack-start/scripts.md +103 -0
  238. package/docs/frameworks/vue/embeds.md +84 -0
  239. package/docs/frameworks/vue/network-blocker.md +99 -0
  240. package/docs/frameworks/vue/scripts.md +93 -0
  241. package/docs/guides/banner-experiments.md +654 -0
  242. package/docs/guides/troubleshooting.md +120 -47
  243. package/docs/guides/verify-consent.md +81 -49
  244. package/docs/integrations/adobe-analytics.md +167 -159
  245. package/docs/integrations/ahrefs-analytics.md +152 -154
  246. package/docs/integrations/amplitude.md +162 -156
  247. package/docs/integrations/building-integrations.md +136 -37
  248. package/docs/integrations/clearbit.md +154 -154
  249. package/docs/integrations/cloudflare-web-analytics.md +156 -156
  250. package/docs/integrations/cloudflare-zaraz.md +209 -261
  251. package/docs/integrations/crisp.md +164 -158
  252. package/docs/integrations/databuddy.md +157 -173
  253. package/docs/integrations/fathom-analytics.md +158 -156
  254. package/docs/integrations/front-chat.md +167 -167
  255. package/docs/integrations/google-maps.md +118 -83
  256. package/docs/integrations/google-tag-manager.md +178 -163
  257. package/docs/integrations/google-tag.md +163 -160
  258. package/docs/integrations/heap.md +163 -155
  259. package/docs/integrations/hightouch.md +161 -157
  260. package/docs/integrations/hotjar.md +159 -155
  261. package/docs/integrations/intercom.md +183 -153
  262. package/docs/integrations/klaviyo.md +486 -0
  263. package/docs/integrations/linkedin-insights.md +174 -150
  264. package/docs/integrations/logrocket.md +160 -156
  265. package/docs/integrations/matomo-analytics.md +188 -178
  266. package/docs/integrations/meta-pixel.md +188 -150
  267. package/docs/integrations/microsoft-clarity.md +163 -155
  268. package/docs/integrations/microsoft-uet.md +148 -154
  269. package/docs/integrations/mixpanel-analytics.md +155 -160
  270. package/docs/integrations/one-dollar-stats.md +166 -165
  271. package/docs/integrations/openai-pixel.md +204 -301
  272. package/docs/integrations/overview.md +137 -80
  273. package/docs/integrations/pinterest-tag.md +191 -183
  274. package/docs/integrations/pirsch.md +169 -159
  275. package/docs/integrations/plausible-analytics.md +172 -158
  276. package/docs/integrations/posthog.md +313 -240
  277. package/docs/integrations/promptwatch.md +154 -154
  278. package/docs/integrations/reddit-pixel.md +185 -157
  279. package/docs/integrations/rudderstack.md +201 -186
  280. package/docs/integrations/rybbit-analytics.md +171 -160
  281. package/docs/integrations/segment.md +182 -154
  282. package/docs/integrations/snapchat-pixel.md +186 -156
  283. package/docs/integrations/tiktok-pixel.md +171 -150
  284. package/docs/integrations/umami-analytics.md +163 -158
  285. package/docs/integrations/vercel-analytics.md +166 -157
  286. package/docs/integrations/x-pixel.md +176 -150
  287. package/docs/integrations/youtube.md +121 -86
  288. package/docs/upgrade-v3.md +496 -467
  289. package/package.json +10 -257
  290. package/dist-types/__tests__/helpers.d.ts +0 -141
  291. package/docs/assets/v3/brand-bar.png +0 -0
  292. package/docs/assets/v3/mobile-card.png +0 -0
  293. package/docs/assets/v3/preferences.png +0 -0
  294. package/docs/frameworks/javascript/script-loader.md +0 -100
  295. package/docs/frameworks/next/script-loader.md +0 -216
  296. package/docs/frameworks/react/script-loader.md +0 -69
  297. package/docs/guides/deployment-modes.md +0 -75
  298. package/docs/guides/shared-consent-controls.md +0 -158
  299. package/docs/integrations/clear-on-revocation.md +0 -167
  300. package/docs/integrations/granular-consent.md +0 -210
@@ -0,0 +1,202 @@
1
+ ---
2
+ title: Class names and CSS-in-JS
3
+ description: Style c15t's component parts with CSS Modules, vanilla-extract,
4
+ StyleX, Emotion or plain class names, and see which approach works in each
5
+ framework.
6
+ group: customization
7
+ ---
8
+
9
+ ## Pass a class to a part
10
+
11
+ CSS Modules, vanilla-extract, StyleX, Emotion and Tailwind all end up as a class
12
+ on an element and a rule in a stylesheet. Give c15t the class through your
13
+ framework's part API, and the rule wins over c15t's own rule for that part:
14
+ c15t's rules sit in the `components` cascade layer, and an unlayered rule from
15
+ your stylesheet outranks any layered one.
16
+
17
+ Each example below adds a 3px colored border and 4px corners to the banner card.
18
+ The React examples run as Storybook stories in CI, which check that each class
19
+ lands on the card and that the computed border comes from the class, not from
20
+ c15t's own card rule. The script tag examples run in the example app's browser
21
+ tests.
22
+
23
+ | Framework | Part API | Class key | Inline `style` | Where the class's CSS must load |
24
+ | ------------------------------ | ----------------------------------------------------------------------- | ----------------------------------------- | -------------- | ------------------------------------------------------------------------------------ |
25
+ | Next.js, TanStack Start, React | `components.<component>.<part>`, or `theme.slots` | `className` | Yes | Anywhere on the page |
26
+ | Nuxt, Vue | `components.<component>.<part>`, or `theme.slots` | `class` (`className` in `theme.slots`) | Yes | Anywhere on the page |
27
+ | Svelte, SvelteKit | `theme.slots`, or `class` on a component | A string, or `className` in a slot object | Yes | A global stylesheet, or `:global()` |
28
+ | Astro | `theme.slots` in the integration options, or `class` on `ConsentBanner` | A string, or `className` in a slot object | Yes | A global stylesheet |
29
+ | HTML, JavaScript | `ui.theme.slots` | A string, or `className` in a slot object | Yes | Inside the shadow root through `ui.stylesheetURLs`, or anywhere with `shadow: false` |
30
+
31
+ [Component parts](./slots.md) lists the parts and their keys in
32
+ each framework.
33
+
34
+ ## CSS Modules
35
+
36
+ Import the module and pass its class. This works wherever your bundler compiles
37
+ CSS Modules:
38
+
39
+ ```css title="src/banner.module.css"
40
+ .card {
41
+ border: 3px solid rgb(219 39 119);
42
+ border-radius: 4px;
43
+ }
44
+ ```
45
+
46
+ ```ts title="src/consent-components.ts"
47
+ import type { ConsentProviderOptions } from 'c15t/react';
48
+
49
+ import styles from './banner.module.css';
50
+
51
+ /** Pass as `components` in your ConsentProvider options. */
52
+ export const components: ConsentProviderOptions['components'] = {
53
+ banner: { card: { className: styles.card } },
54
+ };
55
+ ```
56
+
57
+ Pass `components` in your `ConsentProvider` options, or in `options` on
58
+ `ConsentRoot` in Next.js and TanStack Start.
59
+
60
+ ## vanilla-extract
61
+
62
+ vanilla-extract compiles `style()` calls in `.css.ts` files to static CSS at
63
+ build time. Add its plugin for your bundler, such as
64
+ `@vanilla-extract/vite-plugin`, then pass the class:
65
+
66
+ ```ts title="src/consent-components.css.ts"
67
+ import { style } from '@vanilla-extract/css';
68
+ import type { ConsentProviderOptions } from 'c15t/react';
69
+
70
+ const card = style({ border: '3px solid rgb(37 99 235)', borderRadius: 4 });
71
+
72
+ /** Pass as `components` in your ConsentProvider options. */
73
+ export const components: ConsentProviderOptions['components'] = {
74
+ banner: { card: { className: card } },
75
+ };
76
+ ```
77
+
78
+ ## StyleX
79
+
80
+ `stylex.props()` returns `className` and, for dynamic values, `style`. A React
81
+ part accepts both, so spread the result into the part. Add the StyleX compiler
82
+ plugin for your bundler, such as `@stylexjs/unplugin`:
83
+
84
+ ```ts title="src/consent-components.ts"
85
+ import * as stylex from '@stylexjs/stylex';
86
+ import type { ConsentProviderOptions } from 'c15t/react';
87
+
88
+ const styles = stylex.create({
89
+ card: {
90
+ borderColor: 'rgb(22 163 74)',
91
+ borderRadius: 4,
92
+ borderStyle: 'solid',
93
+ borderWidth: 3,
94
+ },
95
+ });
96
+
97
+ /**
98
+ * Pass as `components` in your ConsentProvider options. `stylex.props()`
99
+ * returns `className` and, for dynamic styles, `style`; the slot takes both.
100
+ */
101
+ export const components: ConsentProviderOptions['components'] = {
102
+ banner: { card: stylex.props(styles.card) },
103
+ };
104
+ ```
105
+
106
+ StyleX writes atomic classes into an unlayered stylesheet, so they outrank
107
+ c15t's layered rules without extra specificity.
108
+
109
+ ## Emotion
110
+
111
+ `css()` from `@emotion/css` returns a class name and inserts its rule into a
112
+ `<style>` element in the document `<head>` when your code runs:
113
+
114
+ ```ts title="src/consent-components.ts"
115
+ import { css } from '@emotion/css';
116
+ import type { ConsentProviderOptions } from 'c15t/react';
117
+
118
+ const card = css({ border: '3px solid rgb(234 88 12)', borderRadius: 4 });
119
+
120
+ /** Pass as `components` in your ConsentProvider options. */
121
+ export const components: ConsentProviderOptions['components'] = {
122
+ banner: { card: { className: card } },
123
+ };
124
+ ```
125
+
126
+ Emotion inserts its rules into the page, not into a shadow root. With the HTML
127
+ script tag or `@c15t/browser`, set `ui: { shadow: false }` so the UI renders
128
+ in the page where those rules reach it. `ui.stylesheetURLs` cannot carry them,
129
+ because they have no URL.
130
+
131
+ ## Use other frameworks' part APIs
132
+
133
+ Vue and Nuxt bind a part's object to the element with `v-bind`, so write
134
+ `class` rather than `className`. A class string from CSS Modules,
135
+ vanilla-extract or Emotion works the same way. To use StyleX, map its
136
+ `className` to `class`.
137
+
138
+ Svelte scopes component styles, so a class defined in a component's `<style>`
139
+ block does not reach a c15t part. Define it in a global stylesheet or with
140
+ `:global(.your-class)`. `theme.slots` accepts a string or
141
+ `{ className, style }`, and `class` on `ConsentBanner` goes on the banner root.
142
+
143
+ Astro serializes its integration options, so `theme.slots` in
144
+ `astro.config.mjs` takes plain strings and objects. Use class names from a
145
+ global stylesheet or Tailwind there. Build-time tools that export class names
146
+ from a module, such as CSS Modules, cannot reach `astro.config.mjs`.
147
+
148
+ ## Style the script tag's shadow root
149
+
150
+ The script tag and `init()` from `@c15t/browser` render into a shadow root. A
151
+ class from your page's stylesheet reaches a part only if the stylesheet reaches
152
+ the shadow root. Pick one:
153
+
154
+ * **`ui.stylesheetURLs`.** c15t links each URL inside the shadow root, after
155
+ its own stylesheet. Link the stylesheet that holds your classes, such as your
156
+ CSS Modules or Tailwind build.
157
+ * **`::part()`.** Every part with a slot key carries it in a `part` attribute.
158
+ Page CSS can style it with `[data-c15t-ui]::part(consentBannerCard)`,
159
+ without any class.
160
+ * **`ui.css`.** A string of CSS that c15t adds inside the shadow root.
161
+ * **`shadow: false`.** c15t renders into the page and every page stylesheet
162
+ applies, including Emotion's.
163
+
164
+ This example links a Tailwind build into the shadow root and puts utilities on
165
+ two parts:
166
+
167
+ ```html title="index.html"
168
+ <link
169
+ rel="stylesheet"
170
+ href="/tailwind.css"
171
+ />
172
+ <script>
173
+ window.c15t = window.c15t || [];
174
+ c15t.push([
175
+ 'config',
176
+ {
177
+ ui: {
178
+ // The banner renders in a shadow root, where the page's
179
+ // stylesheets do not reach. Link your Tailwind build into it
180
+ // too, and keep the page's own link: Tailwind 4 registers
181
+ // variables with @property, which only works in the page.
182
+ stylesheetURLs: ['/tailwind.css'],
183
+ theme: {
184
+ slots: {
185
+ consentBannerCard: 'rounded-none border-4 border-sky-600',
186
+ consentBannerTitle: 'uppercase tracking-wide',
187
+ },
188
+ },
189
+ },
190
+ },
191
+ ]);
192
+ </script>
193
+ ```
194
+
195
+ ## Check the result
196
+
197
+ 1. Open the page in a private window so the banner shows.
198
+ 2. Select the banner card in the Elements panel. It carries your class.
199
+ 3. In the Styles panel, your rule applies and c15t's rule for the same
200
+ property is struck out. If your class is on the element but its rule is
201
+ missing, the stylesheet does not reach the part. Check the "Where the class's CSS
202
+ must load" column in [Pass a class to a part](#pass-a-class-to-a-part).
@@ -0,0 +1,157 @@
1
+ ---
2
+ title: Dark mode
3
+ description: Switch c15t's banner and dialog to dark colors with colorScheme,
4
+ set your own dark tokens, follow your site's theme switch, and paint dark on
5
+ the first frame in every framework.
6
+ group: customization
7
+ ---
8
+
9
+ ## How c15t turns dark
10
+
11
+ c15t's stylesheet switches every `--c15t-*` color token to its dark value when
12
+ `<html>` has a `dark` or a `c15t-dark` class. The `colorScheme` option decides
13
+ whether c15t sets `c15t-dark` itself:
14
+
15
+ | `colorScheme` | What c15t does with `c15t-dark` |
16
+ | ------------- | ------------------------------------------------------------------------ |
17
+ | `'light'` | Removes it once |
18
+ | `'dark'` | Adds it once |
19
+ | `'system'` | Follows `prefers-color-scheme`, including changes while the page is open |
20
+ | Unset | Copies your `dark` class into `c15t-dark` and follows it as it changes |
21
+ | `null` | Leaves it alone. Your site sets it |
22
+
23
+ Astro also accepts `'none'`, which means the same as `null`.
24
+
25
+ `'light'` only removes `c15t-dark`. If your site puts `dark` on `<html>`, the
26
+ stylesheet still switches the tokens to dark. Pick one class convention for
27
+ your site and let c15t follow it.
28
+
29
+ ## Defaults in each framework
30
+
31
+ | Framework | Where to set it | Default |
32
+ | ----------------------- | --------------------------------------------------------------------------------- | -------------------- |
33
+ | Next.js, TanStack Start | `options.colorScheme` on `ConsentRoot`, and `colorScheme` on `ConsentTheme` | Unset: copies `dark` |
34
+ | React | `colorScheme` in the `ConsentProvider` options, and on `ConsentTheme` | Unset: copies `dark` |
35
+ | Nuxt | `colorScheme` under the `c15t` key in `nuxt.config.ts`, or in `app/app.config.ts` | Unset: copies `dark` |
36
+ | Vue | `colorScheme` in the `c15tVue` options | Unset: copies `dark` |
37
+ | Astro | `colorScheme` in the `c15t()` integration options | `'system'` |
38
+ | Svelte, SvelteKit | `colorScheme` on `ConsentManagerProvider` | Unset: copies `dark` |
39
+ | HTML | `data-color-scheme` on the script tag: `light`, `dark`, `system` or `none` | `system` |
40
+ | JavaScript | `ui.colorScheme` in `init()` | `'system'` |
41
+
42
+ React, Vue and Svelte apps usually already have a theme switch that toggles a
43
+ `dark` class, such as next-themes. Copying that class keeps c15t in step with
44
+ the site without extra code.
45
+
46
+ Astro and the script tag default to `'system'` because neither can rely on a
47
+ site convention. Astro paints the banner from server HTML before any site
48
+ script runs, and Astro sites share no `dark` class convention, so following the
49
+ operating system is the one choice its inline script can make correctly. A plain
50
+ HTML page has no convention either. A site that has one opts in with `null`.
51
+
52
+ ### Set colorScheme null in Nuxt
53
+
54
+ In Nuxt, set `colorScheme: null` under the `c15t` key in `nuxt.config.ts` or
55
+ in `app/app.config.ts`. Nuxt drops a `null` in inline module options, such as
56
+ `modules: [['@c15t/vue', { colorScheme: null }]]`, before the module reads it,
57
+ so c15t would copy your `dark` class as if `colorScheme` were unset.
58
+
59
+ ## Follow your site's theme switch
60
+
61
+ In React, Next.js, TanStack Start, Vue, Nuxt, Svelte and SvelteKit, leave
62
+ `colorScheme` unset and toggle `dark` on `<html>`. c15t watches the class and switches with
63
+ it. Include the class in the server HTML when your site renders dark, so the
64
+ first paint matches.
65
+
66
+ In Astro, set `colorScheme: 'none'` and toggle `c15t-dark` together with your
67
+ own class. A `ClientRouter` navigation replaces the attributes of `<html>`, so
68
+ set the class again on `astro:after-swap` if your theme script does not.
69
+
70
+ With the script tag, add `data-color-scheme="none"`. With `init()`, pass
71
+ `ui: { colorScheme: null }`. The UI is then dark while `<html>` has `dark` or
72
+ `c15t-dark`, and follows the class as it changes. The UI renders in a shadow
73
+ root that the page's class cannot reach, so c15t copies the class onto the
74
+ shadow host.
75
+
76
+ If your site sets `c15t-dark` itself in React, Next.js, TanStack Start, Vue,
77
+ Nuxt, Svelte or SvelteKit, pass `colorScheme: null` so c15t leaves it alone.
78
+
79
+ ## Set your own dark colors
80
+
81
+ Theme tokens take a `dark` object with the same color keys as `colors`. Every
82
+ color you set in `colors` also applies in dark mode, unless `dark` sets it too,
83
+ so give a dark value for each brand color:
84
+
85
+ ```ts title="consent-theme.ts"
86
+ export const theme = {
87
+ colors: { primary: '#2f6f4e', primaryHover: '#24563c', surface: '#fbf8f3' },
88
+ dark: { primary: '#7fd1a8', primaryHover: '#9fdcbd', surface: '#1b1f1d' },
89
+ };
90
+ ```
91
+
92
+ Where the theme goes depends on the framework:
93
+
94
+ * **React, Next.js, TanStack Start.** Pass it to `ConsentTheme`. To write the
95
+ CSS outside a component, call `generateThemeCSS(theme, colorScheme)` from
96
+ `c15t/react/utils`, or `@c15t/react/utils` if you installed the scoped
97
+ package. It writes the same CSS as `ConsentTheme`.
98
+ * **Vue, Nuxt.** Pass it as `theme` in the plugin or module options. It goes
99
+ into the `<style id="c15t-css-vars">` element with `tokens`.
100
+ * **Astro.** Pass it as `theme` in the integration options.
101
+ * **SvelteKit, Svelte.** Pass it to `generateThemeCSS(theme, colorScheme)` from
102
+ `@c15t/ui/theme` on the server.
103
+ * **HTML, JavaScript.** Pass it as `ui.theme`.
104
+
105
+ This Nuxt example follows the system setting and uses its own dark primary
106
+ color. Every other dark token keeps c15t's default:
107
+
108
+ ```ts title="nuxt.config.ts (c15t options)"
109
+ // Follow the visitor's system setting, with a dark primary of our own.
110
+ colorScheme: 'system',
111
+ theme: { dark: { primary: '#7fd1a8' } },
112
+ ```
113
+
114
+ To set dark values in plain CSS instead, write them for both classes:
115
+
116
+ ```css
117
+ :root.dark,
118
+ :root.c15t-dark {
119
+ --c15t-primary: #7fd1a8;
120
+ --c15t-surface: #1b1f1d;
121
+ }
122
+ ```
123
+
124
+ A generated theme, such as the output of `ConsentTheme` or
125
+ `generateThemeCSS`, writes its dark values on `:root:root.dark` and
126
+ `:root:root.c15t-dark`. Those selectors outrank the rule above. If you use both,
127
+ put dark values in the theme, or repeat `:root` in your own selectors.
128
+
129
+ ## Paint dark on the first frame
130
+
131
+ A banner that renders light and then turns dark flashes. How to avoid that
132
+ depends on where the banner first renders:
133
+
134
+ | Framework | What to do |
135
+ | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
136
+ | Next.js, TanStack Start | Render `<ConsentTheme theme={theme} colorScheme="system" />` on the server, with the same value as `options.colorScheme`. `'dark'` writes dark tokens as the default and `'system'` adds a `prefers-color-scheme` media query, so the server HTML is dark before hydration. With `colorScheme` unset, put your `dark` class in the server HTML. |
137
+ | React | Render `<ConsentTheme colorScheme="system" />` next to the provider, with the same value as the provider's `colorScheme`. Its CSS makes the tokens dark from the first frame, before the provider sets the class. In a server-rendered React app, render it on the server. |
138
+ | Nuxt | For `'dark'` and `'system'`, the module adds an inline script to `<head>` that sets `c15t-dark` before the server-rendered banner paints. It carries the module's `nonce`. With `colorScheme` unset, put your `dark` class in the server HTML. |
139
+ | Vue | The plugin applies `colorScheme` and writes the tokens when you install it, before the first render. |
140
+ | Astro | `ConsentScript` in `<head>` sets the class from an inline script before the banner paints, and c15t sets it again after each `ClientRouter` navigation. Keep `ConsentScript` in your layout's `<head>`. |
141
+ | Svelte | The provider sets the class as it mounts. With `colorScheme` unset, the stylesheet reads your `dark` class directly, so the tokens are dark from the first frame. |
142
+ | SvelteKit | Pass the scheme to `generateThemeCSS(theme, 'system')` in your server load, so the CSS in `<svelte:head>` already has the media query. With `colorScheme` unset, put your `dark` class in the server HTML. |
143
+ | HTML, JavaScript | c15t applies the scheme when it mounts the UI, before any surface renders. |
144
+
145
+ [Theme tokens](./tokens.md) lists every color token, and your
146
+ framework's customize page shows where its theme goes.
147
+
148
+ ## Check the result
149
+
150
+ 1. Open the page in a private window with your operating system in dark mode,
151
+ or add your `dark` class to `<html>`.
152
+ 2. The banner is dark on its first frame. Reload with the Network panel
153
+ throttled to see the first paint.
154
+ 3. Open the preference dialog. It uses the same dark tokens as the banner.
155
+ 4. Switch the scheme while the page is open. With `'system'` or an unset
156
+ `colorScheme`, the banner and dialog follow without a reload.
157
+ 5. Check the contrast of the primary button text in both schemes.
@@ -0,0 +1,119 @@
1
+ ---
2
+ title: Motion and animation
3
+ description: Change how fast c15t's banner and dialog animate with duration and
4
+ easing tokens, turn animations off per surface with disableAnimation, and
5
+ check reduced-motion behavior in each framework.
6
+ group: customization
7
+ ---
8
+
9
+ ## Change the speed with motion tokens
10
+
11
+ c15t animates its surfaces with three durations and four easing curves. Set
12
+ them in the theme's `motion` object, or as CSS variables:
13
+
14
+ | CSS variable | Theme key | Default | Used by |
15
+ | ------------------------ | ------------------------ | -------------------------------------- | ----------------------------------------------- |
16
+ | `--c15t-duration-fast` | `motion.duration.fast` | `80ms` | Banner, buttons, tabs |
17
+ | `--c15t-duration-normal` | `motion.duration.normal` | `150ms` | Preference dialog, switches, accordions |
18
+ | `--c15t-duration-slow` | `motion.duration.slow` | `200ms` | Legal links, floating trigger |
19
+ | `--c15t-easing` | `motion.easing` | `cubic-bezier(0.4, 0, 0.2, 1)` | Banner fade, switches, accordions |
20
+ | `--c15t-easing-out` | `motion.easingOut` | `cubic-bezier(0.215, 0.61, 0.355, 1)` | Preference dialog, floating trigger hover |
21
+ | `--c15t-easing-in-out` | `motion.easingInOut` | `cubic-bezier(0.645, 0.045, 0.355, 1)` | Floating trigger snapping to a corner |
22
+ | `--c15t-easing-spring` | `motion.easingSpring` | `cubic-bezier(0.34, 1.56, 0.64, 1)` | The banner's slide in and the dialog's scale in |
23
+
24
+ This theme slows the dialog down and removes the banner's overshoot:
25
+
26
+ ```ts title="consent-theme.ts"
27
+ export const theme = {
28
+ motion: {
29
+ duration: { fast: '120ms', normal: '220ms' },
30
+ easingSpring: 'cubic-bezier(0.215, 0.61, 0.355, 1)',
31
+ },
32
+ };
33
+ ```
34
+
35
+ The theme goes where your framework's other tokens go. See
36
+ [theme tokens](./tokens.md) and your framework's customize page.
37
+ In Vue and Nuxt, set `tokens` with the variable name without the leading
38
+ `--`, such as `'c15t-duration-normal': '220ms'`.
39
+
40
+ ## Turn animations off
41
+
42
+ `disableAnimation` removes the enter and exit transitions of the banner and
43
+ dialogs, and the hover and snap transitions of the floating
44
+ `ConsentDialogTrigger`. Set it once for every surface, then override it for one
45
+ surface where your framework allows:
46
+
47
+ | Framework | For every surface | For one surface |
48
+ | ----------------------- | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
49
+ | Next.js, TanStack Start | `options.disableAnimation` on `ConsentRoot` | `disableAnimation` prop on `ConsentBanner`, `ConsentDialog`, `IABConsentBanner`, `IABConsentDialog` |
50
+ | React | `disableAnimation` in the `ConsentProvider` options | The same component props |
51
+ | Nuxt | `disableAnimation` in the `c15t` module options | `disableAnimation` prop on `consent-banner.vue`, `consent-manager.vue` and the IAB banner and dialog, when you render them yourself |
52
+ | Vue | `disableAnimation` in the `c15tVue` options | The same component props |
53
+ | Astro | `disableAnimation` in the `c15t()` integration options | `disableAnimation` prop on `ConsentBanner`, `ConsentDialog`, `IABConsentBanner`, `IABConsentDialog` |
54
+ | Svelte, SvelteKit | `disableAnimation` on `ConsentManagerProvider` | `disableAnimation` prop on `ConsentBanner`, `ConsentDialog`, `IABConsentBanner`, `IABConsentDialog` |
55
+ | HTML | `data-disable-animation` on the script tag, or `ui.disableAnimation` in `config` | `ui.banner.disableAnimation`, `ui.dialog.disableAnimation` |
56
+ | JavaScript | `ui.disableAnimation` in `init()` | `ui.banner.disableAnimation`, `ui.dialog.disableAnimation` |
57
+
58
+ A value on one surface wins over the value for every surface.
59
+
60
+ Vue's `ConsentRoot` renders the banner and dialog without props, so in Vue and
61
+ Nuxt a per-surface value only applies when you render the surface components
62
+ yourself.
63
+
64
+ ## Follow the visitor's reduced motion setting
65
+
66
+ c15t's stylesheet stops the banner, dialog, floating trigger, switches, tabs
67
+ and accordions from animating while the visitor asks for reduced motion. The
68
+ rules sit in a `prefers-reduced-motion: reduce` media query, so they apply in
69
+ every framework and follow the setting as it changes, with no option to set.
70
+
71
+ `disableAnimation: false` does not bring the animations back for these
72
+ visitors, because the stylesheet rule applies whatever the option says.
73
+
74
+ ## Animate your own rules on dialog state
75
+
76
+ The preference dialog marks its open state with `data-state`, `open` or
77
+ `closed`, so a rule can animate your own additions to it. Which element
78
+ carries the attribute depends on the framework:
79
+
80
+ | Framework | Elements with `data-state` |
81
+ | ------------------------------ | --------------------------------------------------------------------------------------------------- |
82
+ | HTML, JavaScript | Dialog overlay, positioner and content |
83
+ | Svelte, SvelteKit | Dialog backdrop, positioner and content |
84
+ | Vue, Nuxt | Dialog content and overlay. The dialog unmounts when it closes, so you only see `open` |
85
+ | React, Next.js, TanStack Start | Not on `ConsentDialog`. The `Dialog` primitive's trigger, overlay, content and close parts carry it |
86
+
87
+ Banners do not carry `data-state`. Read `data-prompt`, `data-variant` and the
88
+ other attributes in [component parts](./slots.md) instead.
89
+
90
+ ## Stop transitions while you switch themes
91
+
92
+ Every c15t stylesheet has a `c15t-no-transitions` class that sets
93
+ `transition` and `animation` to `none` on an element and its children. Add it
94
+ to `<html>` while your app swaps themes, so colors change in one frame. Force
95
+ a style and layout pass before you remove it. Otherwise the browser computes
96
+ the new theme only after the class is gone, and the change animates:
97
+
98
+ ```ts
99
+ const root = document.documentElement;
100
+ root.classList.add('c15t-no-transitions');
101
+ applyYourTheme();
102
+ // Reading layout applies the new theme while transitions are off.
103
+ root.getBoundingClientRect();
104
+ root.classList.remove('c15t-no-transitions');
105
+ ```
106
+
107
+ This assumes `applyYourTheme` changes classes or custom properties
108
+ synchronously. If your framework applies the theme in a later render, run the
109
+ last two lines after that render commits.
110
+
111
+ ## Check the result
112
+
113
+ 1. In DevTools, open the Rendering panel and emulate
114
+ `prefers-reduced-motion: reduce`. Reload with site data cleared.
115
+ 2. The banner appears without sliding in.
116
+ 3. Open the preference dialog and toggle a switch. The switch changes without
117
+ animating.
118
+ 4. Turn the emulation off, set a slower `motion.duration.normal`, and open the
119
+ dialog again. It fades in at the new speed.
@@ -1,46 +1,79 @@
1
1
  ---
2
- title: Customize your consent interface
3
- description: Choose presentation, theme tokens, slots or custom markup for the
4
- change you need.
2
+ title: Customize the interface
3
+ description: Change c15t's consent banner and dialog one step at a time, from a
4
+ prop to your own markup, and find where each step lives in your framework.
5
5
  group: customization
6
6
  ---
7
7
 
8
- ## Start with the change you want
8
+ ## Climb the ladder one step at a time
9
9
 
10
- | Change | Use | Why |
11
- | ----------------------------------------- | ----------------------------------- | ------------------------------------------------------------ |
12
- | Banner shape or location | Presentation or banner props | Keeps policy actions and built-in layout behavior |
13
- | Brand colors, radius, typography, spacing | Theme tokens | Changes related component parts together |
14
- | One card, footer, title or button group | Component slots | Targets existing markup |
15
- | Labels, descriptions or language | i18n configuration | Keeps banner and preferences copy consistent |
16
- | A different component structure | Compound components where available | Retains the component behavior while changing markup |
17
- | Your own interaction and markup | Headless APIs | You own rendering, focus behavior and policy action coverage |
10
+ Each step keeps everything the step below it gives you. Stop at the first one
11
+ that makes the change you need:
18
12
 
19
- Most brand changes need tokens and a few slots. Start there before opting out
20
- of the stock styles. The [recipes](./recipes.md) show how each
21
- choice affects a real banner.
13
+ 1. **Props and presentation.** Pick a shape, a position, button order or
14
+ blocking. c15t keeps its markup, styles and behavior.
15
+ 2. **Theme tokens.** Change colors, type, radius, spacing, shadows and motion
16
+ everywhere at once. Dark mode is a second set of tokens.
17
+ 3. **Parts and classes.** Add a class or inline style to one part of one
18
+ component, such as the banner card. Tailwind, CSS Modules and CSS-in-JS
19
+ classes go here.
20
+ 4. **Compose.** Rebuild a component from c15t's parts, in your own layout, while
21
+ c15t still renders the actions the policy requires.
22
+ 5. **Headless.** Render your own markup from c15t's state and actions. You own
23
+ the layout, focus handling and labels.
22
24
 
23
- ## Keep behavior and appearance separate
25
+ Most brand work needs tokens and a few part classes. See
26
+ [banner designs](./recipes.md) for five banners built at
27
+ different steps, with screenshots and tested code.
28
+
29
+ ## Where each step lives in your framework
30
+
31
+ | Framework | Props and presentation | Tokens | Parts and classes | Compose | Headless |
32
+ | -------------- | --------------------------------------------- | ----------------------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------------- |
33
+ | Next.js | `ConsentBanner` props, `options.presentation` | `ConsentTheme` in a Server Component | `options.components`, `className` | [Compose](https://c15t.com/docs/frameworks/next/compose) | [Headless](https://c15t.com/docs/frameworks/next/headless) |
34
+ | TanStack Start | `ConsentBanner` props, `options.presentation` | `ConsentTheme` in the root route | `options.components`, `className` | [Compose](https://c15t.com/docs/frameworks/tanstack-start/compose) | [Headless](https://c15t.com/docs/frameworks/tanstack-start/headless) |
35
+ | React | `ConsentBanner` props, `presentation` | `ConsentTheme`, or CSS variables | `components`, `className` | [Compose](https://c15t.com/docs/frameworks/react/compose) | [Headless](https://c15t.com/docs/frameworks/react/headless) |
36
+ | Nuxt | `presentation` in `nuxt.config.ts` | `tokens` or `theme` in the module options | `components`, `class` | None | [Headless](https://c15t.com/docs/frameworks/nuxt/headless) |
37
+ | Vue | `presentation` in the `c15tVue` options | `tokens` or `theme` in the plugin options | `components`, `class` | None | [Headless](https://c15t.com/docs/frameworks/vue/headless) |
38
+ | Astro | `presentation` in the integration options | `theme` in the integration options | `theme.slots`, `class` on `ConsentBanner` | None | None |
39
+ | Svelte | `ConsentBanner` props, `presentation` | CSS variables, or `generateThemeCSS()` | `theme.slots`, `class` on `ConsentBanner` | [Primitives](https://c15t.com/docs/frameworks/svelte/components/primitives) | [Headless](https://c15t.com/docs/frameworks/svelte/headless) |
40
+ | SvelteKit | `ConsentBanner` props, `presentation` | `generateThemeCSS()` in a server load | `theme.slots`, `class` on `ConsentBanner` | [Primitives](https://c15t.com/docs/frameworks/sveltekit/components/primitives) | [Headless](https://c15t.com/docs/frameworks/sveltekit/headless) |
41
+ | HTML | `presentation.prompt` in `config` | `ui.theme` | `ui.theme.slots`, `::part()`, `ui.css` | None | [Headless](https://c15t.com/docs/frameworks/html/headless) |
42
+ | JavaScript | `presentation.prompt` in `init()` | `ui.theme` | `ui.theme.slots`, `::part()`, `ui.css` | None | [Headless](https://c15t.com/docs/frameworks/javascript/headless) |
24
43
 
25
- Presentation controls the prompt's shape, position and blocking behavior.
26
- Policy controls which actions and rights are required. Changing colors or button
27
- order does not change a saved choice or policy scope.
44
+ Configuration shapes differ between frameworks. React's
45
+ `components.banner.card`, Vue's `components.banner.card` with `class`, and the
46
+ `consentBannerCard` key in `theme.slots` target the same part through
47
+ different APIs. Check your framework's customize page before you move a
48
+ configuration from one framework to another.
49
+
50
+ ## Keep behavior and appearance separate
28
51
 
29
- A choice wall always blocks. Notices never block and cannot become a wall merely
30
- because `variant: 'wall'` was requested. Preference dialogs remain centered;
31
- prompt positioning does not move them. Required actions omitted from a custom
32
- layout can be restored by the policy renderer.
52
+ Presentation controls the prompt's shape, position and blocking. The policy
53
+ controls which actions and rights the visitor gets. Changing colors or button
54
+ order does not change a saved choice or the policy's scope.
33
55
 
34
- ## Use the adapter's configuration shape
56
+ A choice wall always blocks. A notice never blocks and does not become a wall
57
+ because you asked for `variant: 'wall'`. The preference dialog stays centered,
58
+ whatever position the banner has. If a custom layout leaves out an action the
59
+ policy requires, c15t puts it back.
35
60
 
36
- React and Next.js accept provider `theme`, `presentation` and `components`
37
- options, and render theme tokens with `ConsentTheme` on the server. Vue and Nuxt expose their own shared configuration, including CSS
38
- `tokens` and component slots. Svelte accepts its provider options and theme
39
- slots; SvelteKit renders the token CSS from a server `load`. Astro serializes
40
- integration options, renders the theme tokens on the server and uses the
41
- selected adapter for dialogs. Do not move a configuration object between frameworks without checking
42
- the target types.
61
+ ## Read the rest of this section
43
62
 
44
- Read [tokens and CSS](./tokens.md),
45
- [slots](./slots.md) or
46
- [copy and translations](./translations.md) for the next step.
63
+ * [Banner designs](./recipes.md): five designs with tested code.
64
+ * [Theme tokens](./tokens.md): every `--c15t-*` variable and
65
+ its theme key.
66
+ * [Dark mode](./dark-mode.md): `colorScheme`, dark tokens and a
67
+ dark first paint.
68
+ * [Motion and animation](./motion.md): duration and easing
69
+ tokens, `disableAnimation` and reduced motion.
70
+ * [Stylesheets and CSS layers](./stylesheets.md): which file to
71
+ load, when the dialog's CSS loads, and how to run without c15t's styles.
72
+ * [Component parts](./slots.md): every part, its keys in each
73
+ framework, and the `data-*` attributes to select on.
74
+ * [Class names and CSS-in-JS](./class-names.md): CSS Modules,
75
+ vanilla-extract, StyleX and Emotion on c15t's parts.
76
+ * [Tailwind CSS](./tailwind.md): Tailwind 4 and 3 in every
77
+ framework.
78
+ * [Copy and translations](./translations.md): labels,
79
+ languages and right-to-left text.