@c15t/react 2.0.0-rc.5 → 2.0.0-rc.7

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 (279) hide show
  1. package/dist/components/consent-banner/atoms/overlay.cjs +1 -1
  2. package/dist/components/consent-banner/atoms/root.cjs +1 -1
  3. package/dist/components/consent-banner/atoms/root.js +1 -1
  4. package/dist/components/consent-banner/components.cjs +1 -1
  5. package/dist/components/consent-banner/components.js +1 -1
  6. package/dist/components/consent-banner/consent-banner.cjs +1 -1
  7. package/dist/components/consent-banner/consent-banner.js +1 -1
  8. package/dist/components/consent-banner/error-boundary.cjs +1 -1
  9. package/dist/components/consent-banner/index.cjs +1 -1
  10. package/dist/components/consent-banner/index.js +1 -1
  11. package/dist/components/consent-dialog/atoms/card.cjs +1 -1
  12. package/dist/components/consent-dialog/atoms/card.js +1 -1
  13. package/dist/components/consent-dialog/atoms/overlay.cjs +1 -1
  14. package/dist/components/consent-dialog/atoms/overlay.js +1 -1
  15. package/dist/components/consent-dialog/atoms/root.cjs +1 -1
  16. package/dist/components/consent-dialog/atoms/root.js +1 -1
  17. package/dist/components/consent-dialog/consent-dialog.cjs +1 -1
  18. package/dist/components/consent-dialog/index.cjs +1 -1
  19. package/dist/components/consent-dialog/index.js +1 -1
  20. package/dist/components/consent-dialog-link/index.cjs +1 -1
  21. package/dist/components/consent-dialog-link/index.js +1 -1
  22. package/dist/components/consent-dialog-trigger/atoms/button.cjs +1 -1
  23. package/dist/components/consent-dialog-trigger/atoms/icon.cjs +1 -1
  24. package/dist/components/consent-dialog-trigger/atoms/icon.js +1 -1
  25. package/dist/components/consent-dialog-trigger/atoms/root.cjs +1 -1
  26. package/dist/components/consent-dialog-trigger/atoms/root.js +1 -1
  27. package/dist/components/consent-dialog-trigger/atoms/text.cjs +1 -1
  28. package/dist/components/consent-dialog-trigger/atoms/text.js +1 -1
  29. package/dist/components/consent-dialog-trigger/consent-dialog-trigger.cjs +1 -1
  30. package/dist/components/consent-dialog-trigger/consent-dialog-trigger.js +1 -1
  31. package/dist/components/consent-dialog-trigger/index.cjs +1 -1
  32. package/dist/components/consent-dialog-trigger/index.js +1 -1
  33. package/dist/components/consent-dialog-trigger/types.cjs +1 -1
  34. package/dist/components/consent-dialog-trigger/use-draggable.cjs +1 -1
  35. package/dist/components/consent-dialog-trigger/use-draggable.js +1 -1
  36. package/dist/components/consent-preferences-link/consent-preferences-link.cjs +1 -1
  37. package/dist/components/consent-preferences-link/index.cjs +1 -1
  38. package/dist/components/consent-preferences-link/index.js +1 -1
  39. package/dist/components/consent-widget/atoms/accordion.cjs +1 -1
  40. package/dist/components/consent-widget/atoms/accordion.js +1 -1
  41. package/dist/components/consent-widget/atoms/button.cjs +1 -1
  42. package/dist/components/consent-widget/atoms/footer.cjs +1 -1
  43. package/dist/components/consent-widget/atoms/root.cjs +1 -1
  44. package/dist/components/consent-widget/consent-widget.cjs +1 -1
  45. package/dist/components/consent-widget/consent-widget.js +1 -1
  46. package/dist/components/consent-widget/index.cjs +1 -1
  47. package/dist/components/consent-widget/index.js +1 -1
  48. package/dist/components/consent-widget/types.cjs +1 -1
  49. package/dist/components/frame/atoms.cjs +1 -1
  50. package/dist/components/frame/frame.cjs +1 -1
  51. package/dist/components/frame/index.cjs +1 -1
  52. package/dist/components/frame/index.js +1 -1
  53. package/dist/components/frame/types.cjs +1 -1
  54. package/dist/components/iab-consent-banner/atoms/button-group.cjs +1 -1
  55. package/dist/components/iab-consent-banner/atoms/card.cjs +1 -1
  56. package/dist/components/iab-consent-banner/atoms/card.js +1 -1
  57. package/dist/components/iab-consent-banner/atoms/description.cjs +1 -1
  58. package/dist/components/iab-consent-banner/atoms/footer.cjs +1 -1
  59. package/dist/components/iab-consent-banner/atoms/footer.js +1 -1
  60. package/dist/components/iab-consent-banner/atoms/header.cjs +1 -1
  61. package/dist/components/iab-consent-banner/atoms/header.js +1 -1
  62. package/dist/components/iab-consent-banner/atoms/overlay.cjs +1 -1
  63. package/dist/components/iab-consent-banner/atoms/root.cjs +1 -1
  64. package/dist/components/iab-consent-banner/atoms/root.js +1 -1
  65. package/dist/components/iab-consent-banner/atoms/title.cjs +1 -1
  66. package/dist/components/iab-consent-banner/iab-consent-banner.cjs +1 -1
  67. package/dist/components/iab-consent-banner/iab-consent-banner.js +1 -1
  68. package/dist/components/iab-consent-banner/index.cjs +1 -1
  69. package/dist/components/iab-consent-banner/index.js +1 -1
  70. package/dist/components/iab-consent-dialog/atoms/card.cjs +1 -1
  71. package/dist/components/iab-consent-dialog/atoms/card.js +1 -1
  72. package/dist/components/iab-consent-dialog/atoms/content.cjs +1 -1
  73. package/dist/components/iab-consent-dialog/atoms/footer.cjs +1 -1
  74. package/dist/components/iab-consent-dialog/atoms/footer.js +1 -1
  75. package/dist/components/iab-consent-dialog/atoms/header.cjs +1 -1
  76. package/dist/components/iab-consent-dialog/atoms/header.js +1 -1
  77. package/dist/components/iab-consent-dialog/atoms/overlay.cjs +1 -1
  78. package/dist/components/iab-consent-dialog/atoms/purpose-item.cjs +1 -1
  79. package/dist/components/iab-consent-dialog/atoms/purpose-item.js +1 -1
  80. package/dist/components/iab-consent-dialog/atoms/root.cjs +1 -1
  81. package/dist/components/iab-consent-dialog/atoms/root.js +1 -1
  82. package/dist/components/iab-consent-dialog/atoms/stack-item.cjs +1 -1
  83. package/dist/components/iab-consent-dialog/atoms/stack-item.js +1 -1
  84. package/dist/components/iab-consent-dialog/atoms/tabs.cjs +1 -1
  85. package/dist/components/iab-consent-dialog/atoms/tabs.js +1 -1
  86. package/dist/components/iab-consent-dialog/atoms/vendor-list.cjs +1 -1
  87. package/dist/components/iab-consent-dialog/atoms/vendor-list.js +1 -1
  88. package/dist/components/iab-consent-dialog/hooks/use-gvl-data.cjs +1 -1
  89. package/dist/components/iab-consent-dialog/iab-consent-dialog.cjs +1 -1
  90. package/dist/components/iab-consent-dialog/iab-consent-dialog.js +1 -1
  91. package/dist/components/iab-consent-dialog/index.cjs +1 -1
  92. package/dist/components/iab-consent-dialog/index.js +1 -1
  93. package/dist/components/iab-consent-dialog/types.cjs +1 -1
  94. package/dist/components/iab-consent-dialog/use-iab-translations.cjs +1 -1
  95. package/dist/components/shared/libs/policy-actions.cjs +1 -1
  96. package/dist/components/shared/libs/policy-actions.js +1 -1
  97. package/dist/components/shared/libs/polymorphic.cjs +1 -1
  98. package/dist/components/shared/libs/recursive-clone-children.cjs +1 -1
  99. package/dist/components/shared/libs/slot.cjs +1 -0
  100. package/dist/components/shared/libs/slot.js +1 -0
  101. package/dist/components/shared/libs/use-controllable-state.cjs +1 -0
  102. package/dist/components/shared/libs/use-controllable-state.js +1 -0
  103. package/dist/components/shared/primitives/box.cjs +1 -1
  104. package/dist/components/shared/primitives/box.js +1 -1
  105. package/dist/components/shared/primitives/button.cjs +1 -1
  106. package/dist/components/shared/primitives/button.js +1 -1
  107. package/dist/components/shared/primitives/button.types.cjs +1 -1
  108. package/dist/components/shared/primitives/legal-links/index.cjs +1 -1
  109. package/dist/components/shared/primitives/legal-links/index.js +1 -1
  110. package/dist/components/shared/ui/accordion/accordion.cjs +1 -1
  111. package/dist/components/shared/ui/accordion/accordion.js +1 -1
  112. package/dist/components/shared/ui/accordion/accordion.types.cjs +1 -1
  113. package/dist/components/shared/ui/accordion/index.cjs +1 -1
  114. package/dist/components/shared/ui/animated-collapse/animated-collapse.cjs +1 -1
  115. package/dist/components/shared/ui/animated-collapse/index.cjs +1 -1
  116. package/dist/components/shared/ui/animated-collapse/index.js +1 -1
  117. package/dist/components/shared/ui/button/button.cjs +1 -1
  118. package/dist/components/shared/ui/button/button.js +1 -1
  119. package/dist/components/shared/ui/button/button.types.cjs +1 -1
  120. package/dist/components/shared/ui/button/index.cjs +1 -1
  121. package/dist/components/shared/ui/collapsible/collapsible.cjs +1 -0
  122. package/dist/components/shared/ui/collapsible/collapsible.js +1 -0
  123. package/dist/components/shared/ui/collapsible/index.cjs +1 -0
  124. package/dist/components/shared/ui/collapsible/index.js +1 -0
  125. package/dist/components/shared/ui/dialog/dialog.cjs +1 -0
  126. package/dist/components/shared/ui/dialog/dialog.js +1 -0
  127. package/dist/components/shared/ui/dialog/index.cjs +1 -0
  128. package/dist/components/shared/ui/dialog/index.js +1 -0
  129. package/dist/components/shared/ui/icon.cjs +1 -1
  130. package/dist/components/shared/ui/logo.cjs +1 -1
  131. package/dist/components/shared/ui/preference-item/index.cjs +1 -0
  132. package/dist/components/shared/ui/preference-item/index.js +1 -0
  133. package/dist/components/shared/ui/preference-item/preference-item.cjs +1 -0
  134. package/dist/components/shared/ui/preference-item/preference-item.js +1 -0
  135. package/dist/components/shared/ui/switch/index.cjs +1 -1
  136. package/dist/components/shared/ui/switch/switch.cjs +1 -1
  137. package/dist/components/shared/ui/switch/switch.js +1 -1
  138. package/dist/components/shared/ui/switch/switch.types.cjs +1 -1
  139. package/dist/components/shared/ui/tabs/index.cjs +1 -0
  140. package/dist/components/shared/ui/tabs/index.js +1 -0
  141. package/dist/components/shared/ui/tabs/tabs.cjs +1 -0
  142. package/dist/components/shared/ui/tabs/tabs.js +1 -0
  143. package/dist/context/consent-manager-context.cjs +1 -1
  144. package/dist/context/consent-tracking-context.cjs +1 -1
  145. package/dist/context/theme-context.cjs +1 -1
  146. package/dist/headless.cjs +1 -1
  147. package/dist/headless.js +1 -1
  148. package/dist/hooks/index.cjs +1 -1
  149. package/dist/hooks/use-color-scheme.cjs +1 -1
  150. package/dist/hooks/use-component-config.cjs +1 -1
  151. package/dist/hooks/use-consent-dialog-trigger.cjs +1 -1
  152. package/dist/hooks/use-consent-manager.cjs +1 -1
  153. package/dist/hooks/use-focus-trap.cjs +1 -1
  154. package/dist/hooks/use-focus-trap.js +1 -1
  155. package/dist/hooks/use-headless-consent-ui.cjs +1 -1
  156. package/dist/hooks/use-headless-consent-ui.js +1 -1
  157. package/dist/hooks/use-headless-iab-consent-ui.cjs +1 -1
  158. package/dist/hooks/use-reduced-motion.cjs +1 -1
  159. package/dist/hooks/use-reduced-motion.js +1 -1
  160. package/dist/hooks/use-scroll-lock.cjs +1 -1
  161. package/dist/hooks/use-scroll-lock.js +1 -1
  162. package/dist/hooks/use-ssr-status.cjs +1 -1
  163. package/dist/hooks/use-styles.cjs +1 -1
  164. package/dist/hooks/use-text-direction.cjs +1 -1
  165. package/dist/hooks/use-theme.cjs +1 -1
  166. package/dist/hooks/use-theme.js +1 -1
  167. package/dist/hooks/use-translations.cjs +1 -1
  168. package/dist/iab/styles.css +1 -0
  169. package/dist/iab/styles.tw3.css +1 -0
  170. package/dist/iab.cjs +1 -0
  171. package/dist/iab.js +1 -0
  172. package/dist/index.cjs +1 -1
  173. package/dist/index.js +1 -1
  174. package/dist/primitives/accordion.cjs +1 -0
  175. package/dist/primitives/accordion.js +1 -0
  176. package/dist/primitives/button.cjs +1 -0
  177. package/dist/primitives/button.js +1 -0
  178. package/dist/primitives/collapsible.cjs +1 -0
  179. package/dist/primitives/collapsible.js +1 -0
  180. package/dist/primitives/dialog.cjs +1 -0
  181. package/dist/primitives/dialog.js +1 -0
  182. package/dist/primitives/preference-item.cjs +1 -0
  183. package/dist/primitives/preference-item.js +1 -0
  184. package/dist/primitives/switch.cjs +1 -0
  185. package/dist/primitives/switch.js +1 -0
  186. package/dist/primitives/tabs.cjs +1 -0
  187. package/dist/primitives/tabs.js +1 -0
  188. package/dist/primitives.cjs +1 -0
  189. package/dist/primitives.js +1 -0
  190. package/dist/providers/consent-manager-provider.cjs +1 -1
  191. package/dist/providers/consent-manager-provider.js +1 -1
  192. package/dist/server/fetch-ssr-data.cjs +1 -1
  193. package/dist/server/fetch-ssr-data.js +1 -1
  194. package/dist/server/headers.cjs +1 -1
  195. package/dist/server/index.cjs +1 -1
  196. package/dist/server/index.js +1 -1
  197. package/dist/server/init-cache-key.cjs +1 -1
  198. package/dist/server/init-cache-key.js +1 -1
  199. package/dist/server/normalize-url.cjs +1 -1
  200. package/dist/server/types.cjs +1 -1
  201. package/dist/styles.css +1 -0
  202. package/dist/styles.tw3.css +1 -0
  203. package/dist/types/consent-manager.cjs +1 -1
  204. package/dist/types/theme/index.cjs +1 -1
  205. package/dist/types/theme/style-keys.cjs +1 -1
  206. package/dist/types/theme/style-types.cjs +1 -1
  207. package/dist/utils/cn.cjs +1 -1
  208. package/dist/utils/merge-styles.cjs +1 -1
  209. package/dist/utils/test-helpers.cjs +1 -1
  210. package/dist/utils/test-helpers.js +1 -1
  211. package/dist/utils/theme-utils.cjs +1 -1
  212. package/dist/version.cjs +1 -1
  213. package/dist/version.js +1 -1
  214. package/dist-types/components/consent-banner/atoms/overlay.d.ts +1 -1
  215. package/dist-types/components/consent-banner/atoms/root.d.ts +44 -13
  216. package/dist-types/components/consent-banner/components.d.ts +1 -1
  217. package/dist-types/components/consent-banner/index.d.ts +45 -25
  218. package/dist-types/components/consent-dialog/atoms/card.d.ts +1 -1
  219. package/dist-types/components/consent-dialog/atoms/overlay.d.ts +1 -1
  220. package/dist-types/components/consent-dialog/atoms/root.d.ts +1 -1
  221. package/dist-types/components/consent-dialog/index.d.ts +30 -9
  222. package/dist-types/components/consent-dialog-trigger/consent-dialog-trigger.d.ts +2 -2
  223. package/dist-types/components/consent-dialog-trigger/types.d.ts +1 -1
  224. package/dist-types/components/consent-dialog-trigger/use-draggable.d.ts +1 -1
  225. package/dist-types/components/consent-widget/atoms/accordion.d.ts +20 -37
  226. package/dist-types/components/consent-widget/atoms/button.d.ts +1 -1
  227. package/dist-types/components/consent-widget/atoms/root.d.ts +1 -1
  228. package/dist-types/components/consent-widget/index.d.ts +24 -7
  229. package/dist-types/components/frame/atoms.d.ts +1 -1
  230. package/dist-types/components/frame/index.d.ts +1 -1
  231. package/dist-types/components/iab-consent-banner/index.d.ts +1 -1
  232. package/dist-types/components/iab-consent-dialog/atoms/tabs.d.ts +3 -30
  233. package/dist-types/components/iab-consent-dialog/index.d.ts +1 -1
  234. package/dist-types/components/shared/libs/policy-actions.d.ts +3 -3
  235. package/dist-types/components/shared/libs/slot.d.ts +6 -0
  236. package/dist-types/components/shared/libs/use-controllable-state.d.ts +7 -0
  237. package/dist-types/components/shared/ui/accordion/accordion.d.ts +32 -67
  238. package/dist-types/components/shared/ui/button/button.d.ts +2 -2
  239. package/dist-types/components/shared/ui/collapsible/collapsible.d.ts +20 -0
  240. package/dist-types/components/shared/ui/collapsible/index.d.ts +1 -0
  241. package/dist-types/components/shared/ui/dialog/dialog.d.ts +29 -0
  242. package/dist-types/components/shared/ui/dialog/index.d.ts +1 -0
  243. package/dist-types/components/shared/ui/preference-item/index.d.ts +1 -0
  244. package/dist-types/components/shared/ui/preference-item/preference-item.d.ts +33 -0
  245. package/dist-types/components/shared/ui/switch/switch.d.ts +7 -31
  246. package/dist-types/components/shared/ui/tabs/index.d.ts +1 -0
  247. package/dist-types/components/shared/ui/tabs/tabs.d.ts +28 -0
  248. package/dist-types/headless.d.ts +0 -1
  249. package/dist-types/hooks/use-headless-consent-ui.d.ts +1 -1
  250. package/dist-types/iab.d.ts +24 -0
  251. package/dist-types/index.d.ts +0 -3
  252. package/dist-types/primitives/accordion.d.ts +1 -0
  253. package/dist-types/primitives/button.d.ts +1 -0
  254. package/dist-types/primitives/collapsible.d.ts +1 -0
  255. package/dist-types/primitives/dialog.d.ts +1 -0
  256. package/dist-types/primitives/preference-item.d.ts +1 -0
  257. package/dist-types/primitives/switch.d.ts +1 -0
  258. package/dist-types/primitives/tabs.d.ts +1 -0
  259. package/dist-types/primitives.d.ts +7 -0
  260. package/dist-types/version.d.ts +1 -1
  261. package/docs/building-headless-components.md +7 -4
  262. package/docs/components/consent-banner.md +68 -18
  263. package/docs/components/consent-dialog.md +31 -2
  264. package/docs/components/consent-manager-provider.md +1 -0
  265. package/docs/components/consent-widget.md +31 -2
  266. package/docs/concepts/policy-packs.md +1 -1
  267. package/docs/headless.md +13 -7
  268. package/docs/hooks/use-consent-manager/overview.md +2 -2
  269. package/docs/hooks/use-translations.md +1 -0
  270. package/docs/quickstart.md +13 -3
  271. package/docs/styling/classnames.md +17 -9
  272. package/docs/styling/overview.md +166 -29
  273. package/docs/styling/slots.md +37 -7
  274. package/docs/styling/tailwind.md +30 -9
  275. package/package.json +30 -18
  276. package/src/iab/styles.tw3.css +10 -0
  277. package/src/styles.tw3.css +10 -0
  278. package/client/components/iab-consent-banner.js +0 -4
  279. package/client/components/iab-consent-dialog.js +0 -4
@@ -4,9 +4,12 @@ description: Build policy-aware custom consent components in React using the hea
4
4
  ---
5
5
  Building headless components is easier now because c15t exposes policy-aware primitives instead of forcing you to reconstruct banner rules by hand.
6
6
 
7
+ > ⚠️ **Warning:**
8
+ > Headless is the last step in the customization ladder. Use this guide only when pre-built components, tokens, slots, compound components, and noStyle are no longer sufficient.
9
+
7
10
  The headless stack is:
8
11
 
9
- * `useHeadlessConsentUI()` for policy-aware banner/dialog actions, ordering, layout, and primary action hints
12
+ * `useHeadlessConsentUI()` for policy-aware banner/dialog actions, ordering, layout, and primary actions hints
10
13
  * `useConsentManager()` for runtime state, categories, selected consent state, and policy metadata
11
14
  * `useTranslations()` for the resolved copy
12
15
  * `offlinePolicy.policyPacks` for offline previews that behave like backend policy resolution
@@ -24,7 +27,7 @@ The main win is that your custom UI can stay aligned with policy packs without d
24
27
  * the order those actions should render in
25
28
  * grouped actions from policy `layout`
26
29
  * layout `direction` (`row` or `column`)
27
- * the primary action
30
+ * the primary actions
28
31
  * UI profile and scroll-lock hints
29
32
  * whether the banner or dialog should currently be visible
30
33
 
@@ -88,7 +91,7 @@ export function CustomConsentBanner() {
88
91
  <button
89
92
  key={action}
90
93
  type="button"
91
- className={action === banner.primaryAction ? 'btn-primary' : 'btn-secondary'}
94
+ className={banner.primaryActions.includes(action) ? 'btn-primary' : 'btn-secondary'}
92
95
  onClick={() => {
93
96
  if (action === 'customize') {
94
97
  openDialog();
@@ -197,7 +200,7 @@ When you build custom banner or dialog components, make sure they use:
197
200
 
198
201
  * `activeUI` or `banner.isVisible` / `dialog.isVisible` for visibility
199
202
  * `allowedActions`, `orderedActions`, or `actionGroups` instead of hard-coding buttons
200
- * `primaryAction` for visual emphasis
203
+ * `primaryActions` for visual emphasis
201
204
  * `consentCategories` when deciding which category toggles to render
202
205
  * `policyDecision` when you want to debug why a specific UI state was chosen
203
206
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: ConsentBanner
3
- description: A pre-built consent banner that appears when user consent is needed. Supports custom layout, button arrangement, and full compound component composition.
3
+ description: A pre-built consent banner that appears when user consent is needed. Supports policy-aware layout, theming, and advanced composition when markup must change.
4
4
  ---
5
5
  `ConsentBanner` is a ready-to-use consent banner that appears automatically in **opt-in jurisdictions** (like GDPR) where explicit consent is required before tracking. In opt-out jurisdictions (like CCPA), the banner won't appear — users get an opt-out mechanism instead. It includes reject, accept, and customize buttons with configurable layout.
6
6
 
@@ -18,20 +18,6 @@ export function ConsentManager() {
18
18
  }
19
19
  ```
20
20
 
21
- ## Customizing Content
22
-
23
- Override the default title, description, and button labels:
24
-
25
- ```tsx
26
- <ConsentBanner
27
- title="We value your privacy"
28
- description="We use cookies to enhance your browsing experience and analyze site traffic."
29
- acceptButtonText="Accept all"
30
- rejectButtonText="Reject all"
31
- customizeButtonText="Manage preferences"
32
- />
33
- ```
34
-
35
21
  ## Button Layout
36
22
 
37
23
  The `layout` prop controls button arrangement. Each item is either a button ID or an array of button IDs (which groups them together):
@@ -86,6 +72,37 @@ Use the provider `theme` prop to control how stock consent actions look:
86
72
 
87
73
  Policy packs control grouping, ordering, and direction. The theme controls button appearance.
88
74
 
75
+ ## Styling First
76
+
77
+ > ℹ️ **Info:**
78
+ > For pure theming, stay inside the pre-built banner. Start with layout props, theme.consentActions, design tokens, and theme.slots before reaching for compound components. See Styling Overview.
79
+
80
+ The stock banner maps common visual changes to the theme system:
81
+
82
+ * Card background -> `theme.colors.surface`
83
+ * Footer background -> `theme.colors.surfaceHover`
84
+ * Card, footer, and title tweaks -> `theme.slots.consentBannerCard`, `consentBannerFooter`, and `consentBannerTitle`
85
+
86
+ ```tsx
87
+ <ConsentManagerProvider
88
+ options={{
89
+ theme: {
90
+ colors: {
91
+ surface: '#fffdf8',
92
+ surfaceHover: '#f6f3ee',
93
+ },
94
+ slots: {
95
+ consentBannerCard: 'rounded-[28px] shadow-xl',
96
+ consentBannerFooter: 'border-t border-black/10 px-6',
97
+ consentBannerTitle: 'tracking-tight',
98
+ },
99
+ },
100
+ }}
101
+ >
102
+ <ConsentBanner />
103
+ </ConsentManagerProvider>
104
+ ```
105
+
89
106
  ### Primary Button
90
107
 
91
108
  Highlight specific button(s) as the primary action:
@@ -116,9 +133,40 @@ Control which legal links appear in the banner description:
116
133
  > ℹ️ **Info:**
117
134
  > Legal link URLs are configured in the ConsentManagerProvider options via the legalLinks prop, not on the banner itself.
118
135
 
119
- ## Compound Components
136
+ ## Customizing Copy
137
+
138
+ Prefer provider `i18n` when you want to rename the stock banner content:
139
+
140
+ ```tsx
141
+ <ConsentManagerProvider
142
+ options={{
143
+ i18n: {
144
+ locale: 'en',
145
+ messages: {
146
+ en: {
147
+ cookieBanner: {
148
+ title: 'We value your privacy',
149
+ description: 'We use cookies to improve the site and measure performance.',
150
+ },
151
+ common: {
152
+ acceptAll: 'Accept all',
153
+ rejectAll: 'Reject all',
154
+ customize: 'Manage preferences',
155
+ },
156
+ },
157
+ },
158
+ },
159
+ }}
160
+ >
161
+ <ConsentBanner />
162
+ </ConsentManagerProvider>
163
+ ```
164
+
165
+ Direct text props such as `title`, `description`, and `acceptButtonText` are still supported for one-off overrides, but `i18n` is the preferred path for copy changes.
120
166
 
121
- Build fully custom banner layouts using sub-components:
167
+ ## Advanced: Compound Components
168
+
169
+ Use compound components only when the stock banner structure is no longer enough and you need to rearrange existing c15t primitives:
122
170
 
123
171
  ```tsx
124
172
  <ConsentBanner.Root>
@@ -142,7 +190,7 @@ Build fully custom banner layouts using sub-components:
142
190
  * `ConsentBanner.Root` — Outermost container, provides theme context
143
191
  * `ConsentBanner.Card` — Main content card with optional focus trapping
144
192
  * `ConsentBanner.Header` — Contains title and description
145
- * `ConsentBanner.Title` — Heading, defaults to translation `consentBanner.title`
193
+ * `ConsentBanner.Title` — Heading, defaults to translation `cookieBanner.title`
146
194
  * `ConsentBanner.Description` — Description text, supports `legalLinks` prop
147
195
  * `ConsentBanner.Footer` — Action buttons container
148
196
  * `ConsentBanner.FooterSubGroup` — Groups related buttons together
@@ -151,6 +199,8 @@ Build fully custom banner layouts using sub-components:
151
199
  * `ConsentBanner.AcceptButton` — Accepts all consent
152
200
  * `ConsentBanner.Overlay` — Optional backdrop overlay
153
201
 
202
+ If you only need styling changes, stay with tokens and slots instead of rebuilding the banner layout.
203
+
154
204
  ## Props
155
205
 
156
206
  ### ConsentBannerProps
@@ -81,9 +81,36 @@ Hide the c15t branding in the dialog footer:
81
81
  <ConsentDialog hideBranding />
82
82
  ```
83
83
 
84
- ## Compound Components
84
+ ## Styling First
85
85
 
86
- Build fully custom dialog layouts using sub-components:
86
+ > ℹ️ **Info:**
87
+ > If you are only changing visuals, stay with the stock dialog and use the theme system first. Start with tokens and slots such as consentDialogCard, consentDialogHeader, and consentDialogFooter. See Styling Overview.
88
+
89
+ ```tsx
90
+ <ConsentManagerProvider
91
+ options={{
92
+ theme: {
93
+ colors: {
94
+ surface: '#fffdf8',
95
+ surfaceHover: '#f6f3ee',
96
+ },
97
+ slots: {
98
+ consentDialogCard: 'rounded-[32px] shadow-xl',
99
+ consentDialogHeader: 'gap-3',
100
+ consentDialogFooter: 'border-t border-black/10 px-6',
101
+ },
102
+ },
103
+ }}
104
+ >
105
+ <ConsentDialog />
106
+ </ConsentManagerProvider>
107
+ ```
108
+
109
+ Dialog copy should be changed through `ConsentManagerProvider.options.i18n`, not by rebuilding the dialog structure.
110
+
111
+ ## Advanced: Compound Components
112
+
113
+ Use compound components only when you need custom dialog markup while still keeping c15t primitives:
87
114
 
88
115
  ```tsx
89
116
  <ConsentDialog.Root>
@@ -118,6 +145,8 @@ For a quick pre-composed layout, use the shorthand card:
118
145
  </ConsentDialog.Root>
119
146
  ```
120
147
 
148
+ If the stock dialog structure still works, prefer tokens, slots, and provider configuration instead.
149
+
121
150
  ## Props
122
151
 
123
152
  ### ConsentDialogProps
@@ -146,6 +146,7 @@ IAB TCF 2.3 configuration.
146
146
  |Property|Type|Description|Default|Required|
147
147
  |:--|:--|:--|:--|:--:|
148
148
  |enabled|boolean|Enable IAB TCF 2.3 mode. Note: Only works in 'hosted' client mode (legacy alias: 'c15t') because it requires a backend. Options: Fetch GVL from gvl.consent.io; Initialize \_\_tcfapi CMP API; Generate TC Strings for IAB compliance|-|✅ Required|
149
+ |\_module|IABModule \|undefined|IAB runtime module injected by \`@c15t/iab\`.|-|Optional|
149
150
  |cmpId|number \|undefined|CMP ID registered with IAB Europe. When using consent.io as the backend, this is automatically provided via the \`/init\` endpoint — no client-side configuration needed. Only set this if you self-host and have your own CMP registration. A valid (non-zero) CMP ID is required for IAB TCF compliance.|-|Optional|
150
151
  |cmpVersion|string \|number \|undefined|CMP version. When omitted, defaults to package version from \`\~/cmp-defaults\` (which uses \~/version).|-|Optional|
151
152
  |vendors|number\[] \|undefined|IAB-registered vendor IDs to include (optional). Used to scope the vendor list when fetching GVL or when hosted fallback paths are used (e.g. if GVL fetch fails).|-|Optional|
@@ -35,9 +35,36 @@ export function PrivacySettingsPage() {
35
35
 
36
36
  Each consent category is rendered as an expandable accordion item. Clicking the category header expands it to show a description and any associated services. Users can toggle individual categories on or off using the switch control. The `necessary` category is always enabled and cannot be toggled.
37
37
 
38
- ## Compound Components
38
+ ## Styling First
39
39
 
40
- Build fully custom widget layouts using sub-components:
40
+ > ℹ️ **Info:**
41
+ > Most widget customization should stay in the stock component. Use theme tokens and slots such as consentWidgetAccordion, consentWidgetFooter, and toggle before reaching for compound components. See Styling Overview.
42
+
43
+ ```tsx
44
+ <ConsentManagerProvider
45
+ options={{
46
+ theme: {
47
+ colors: {
48
+ surface: '#fffdf8',
49
+ surfaceHover: '#f6f3ee',
50
+ },
51
+ slots: {
52
+ consentWidgetAccordion: 'rounded-3xl border border-black/10',
53
+ consentWidgetFooter: 'border-t border-black/10 px-6',
54
+ toggle: 'shadow-sm',
55
+ },
56
+ },
57
+ }}
58
+ >
59
+ <ConsentWidget />
60
+ </ConsentManagerProvider>
61
+ ```
62
+
63
+ Widget copy should be changed through `ConsentManagerProvider.options.i18n` so the inline UI stays aligned with the rest of the consent experience.
64
+
65
+ ## Advanced: Compound Components
66
+
67
+ Use compound components only when you need to rearrange the widget's existing primitives:
41
68
 
42
69
  ```tsx
43
70
  <ConsentWidget.Root>
@@ -68,6 +95,8 @@ Build fully custom widget layouts using sub-components:
68
95
  * `ConsentWidget.RejectButton` — Rejects all consent
69
96
  * `ConsentWidget.SaveButton` — Saves custom selections
70
97
 
98
+ If the stock widget structure is already correct, stay with tokens and slots instead of rebuilding the layout.
99
+
71
100
  ## Props
72
101
 
73
102
  ### ConsentWidgetProps
@@ -47,7 +47,7 @@ ui: {
47
47
  allowedActions: ['reject', 'accept', 'customize'],
48
48
  layout: [['reject', 'accept'], 'customize'],
49
49
  direction: 'row',
50
- primaryAction: 'customize',
50
+ primaryActions: ['accept', 'customize'],
51
51
  },
52
52
  }
53
53
  ```
package/docs/headless.md CHANGED
@@ -4,11 +4,12 @@ description: Build fully custom consent UI using only hooks - no pre-built compo
4
4
  ---
5
5
  c15t's headless mode means using the hooks (`useConsentManager`, `useTranslations`, etc.) without any pre-built UI components. This gives you complete control over the consent experience.
6
6
 
7
- There are three levels of customization:
7
+ Before you go headless, walk the customization ladder in order:
8
8
 
9
- 1. **Props** - Use pre-built components with custom text and configuration
10
- 2. **noStyle** - Use pre-built components with their structure but strip all styles
11
- 3. **Headless** - Use only hooks and build the entire UI yourself
9
+ 1. **Pre-built components** - Use provider options, component props, tokens, slots, and `theme.consentActions`
10
+ 2. **Compound components** - Rearrange c15t primitives when the markup order must change
11
+ 3. **`noStyle`** - Keep c15t structure but replace its styling
12
+ 4. **Headless** - Use only hooks and build the entire UI yourself
12
13
 
13
14
  ## When to Go Headless
14
15
 
@@ -18,10 +19,15 @@ Go headless when:
18
19
  * You need a consent flow that doesn't fit the banner/dialog pattern
19
20
  * You want to embed consent choices inline rather than as overlays
20
21
 
21
- Use `noStyle` instead when:
22
+ Use a lower-power tool instead when:
22
23
 
23
- * The component structure works but the styling doesn't
24
- * You want to apply your own CSS/Tailwind without fighting defaults
24
+ * The component structure works but the styling doesn't -> use tokens, slots, or `noStyle`
25
+ * You only need to rearrange existing c15t parts -> use compound components
26
+ * You want to change copy -> use `ConsentManagerProvider.options.i18n`
27
+ * You only need to restyle stock actions -> use `theme.consentActions`
28
+
29
+ > ⚠️ **Warning:**
30
+ > Headless mode is not the first answer for pure theming. If you are still trying to debug why a banner footer color did not change, stay in the styling system and verify the token-to-component mapping before you rebuild the UI.
25
31
 
26
32
  > ℹ️ **Info:**
27
33
  > Need a policy-aware implementation guide? See Building Headless Components.
@@ -130,7 +130,7 @@ Policy-driven UI hints for the consent banner surface.
130
130
  |Property|Type|Description|Default|Required|
131
131
  |:--|:--|:--|:--|:--:|
132
132
  |allowedActions|PolicyUiAction \|undefined|Allowed actions for this surface derived from backend runtime policy.|-|Optional|
133
- |primaryAction|PolicyUiAction \|undefined|Preferred primary action hint from backend runtime policy.|-|Optional|
133
+ |primaryActions|PolicyUiAction \|undefined|Preferred primary action hints from backend runtime policy.|-|Optional|
134
134
  |layout|PolicyUiActionGroup \|undefined|Explicit grouped action layout hint from backend runtime policy.|-|Optional|
135
135
  |direction|PolicyUiActionDirection \|undefined|Direction hint for the grouped action layout.|-|Optional|
136
136
  |uiProfile|PolicyUiProfile \|undefined|Presentation profile hint from backend runtime policy.|-|Optional|
@@ -143,7 +143,7 @@ Policy-driven UI hints for the consent dialog surface.
143
143
  |Property|Type|Description|Default|Required|
144
144
  |:--|:--|:--|:--|:--:|
145
145
  |allowedActions|PolicyUiAction \|undefined|Allowed actions for this surface derived from backend runtime policy.|-|Optional|
146
- |primaryAction|PolicyUiAction \|undefined|Preferred primary action hint from backend runtime policy.|-|Optional|
146
+ |primaryActions|PolicyUiAction \|undefined|Preferred primary action hints from backend runtime policy.|-|Optional|
147
147
  |layout|PolicyUiActionGroup \|undefined|Explicit grouped action layout hint from backend runtime policy.|-|Optional|
148
148
  |direction|PolicyUiActionDirection \|undefined|Direction hint for the grouped action layout.|-|Optional|
149
149
  |uiProfile|PolicyUiProfile \|undefined|Presentation profile hint from backend runtime policy.|-|Optional|
@@ -45,6 +45,7 @@ The returned `Translations` object has these sections:
45
45
  |rejectAll|string \|undefined|-|-|✅ Required|
46
46
  |customize|string \|undefined|-|-|✅ Required|
47
47
  |save|string \|undefined|-|-|✅ Required|
48
+ |close|string \|undefined|-|-|✅ Required|
48
49
 
49
50
  #### `cookieBanner` CookieBannerTranslations
50
51
 
@@ -33,7 +33,17 @@ availableIn:
33
33
  |yarn|`yarn add @c15t/react`|
34
34
  |bun|`bun add @c15t/react`|
35
35
 
36
- 2. **Create ConsentManager components** Create a provider component with the consent UI and a wrapper that re-exports it. This initializes the consent store and makes consent state available to all child components.
36
+ 2. **Import styles** Import the prebuilt component stylesheet at the root of your application. This is required for styled components to render correctly.
37
+
38
+ ```tsx
39
+ import '@c15t/react/styles.css';
40
+ ```
41
+
42
+ > ℹ️ Info:
43
+ >
44
+ > If you are using the headless API or fully custom styling, you can skip this import.
45
+
46
+ 3. **Create ConsentManager components** Create a provider component with the consent UI and a wrapper that re-exports it. This initializes the consent store and makes consent state available to all child components.
37
47
 
38
48
  ```tsx
39
49
  'use client';
@@ -73,7 +83,7 @@ availableIn:
73
83
  >
74
84
  > Don't have a backend yet? You can use mode: 'offline' for local-only consent storage, but review the browser-only storage consequences before choosing it for production.
75
85
 
76
- 3. **Mount ConsentManager at the app root** Wrap your existing app tree with ConsentManager so all routes/components can access consent state.
86
+ 4. **Mount ConsentManager at the app root** Wrap your existing app tree with ConsentManager so all routes/components can access consent state.
77
87
 
78
88
  ```tsx
79
89
  import { ConsentManager } from './components/consent-manager';
@@ -87,7 +97,7 @@ availableIn:
87
97
  }
88
98
  ```
89
99
 
90
- 4. **Verify it works** Start your development server and confirm:
100
+ 5. **Verify it works** Start your development server and confirm:
91
101
 
92
102
  A consent banner appears at the bottom of the pageClicking "Customize" opens a dialog with toggles for each consent categoryAfter accepting or rejecting, the banner dismisses and your choice persists across page reloads
93
103
 
@@ -2,15 +2,11 @@
2
2
  title: Class Names
3
3
  description: Style consent components using className props and per-slot className targeting via the theme.
4
4
  ---
5
- ## Component className
5
+ ## Prefer Slots for Stock Components
6
6
 
7
- All consent components accept a `className` prop:
7
+ There is no single top-level `className` contract across every pre-built consent component.
8
8
 
9
- ```tsx
10
- <ConsentBanner className="my-banner" />
11
- <ConsentDialog className="my-dialog" />
12
- <ConsentWidget className="my-widget" />
13
- ```
9
+ For the stock `ConsentBanner`, `ConsentDialog`, and `ConsentWidget`, prefer `theme.slots` first. That keeps the markup intact and lets you target the exact part you need.
14
10
 
15
11
  ## Per-Slot className
16
12
 
@@ -59,9 +55,19 @@ const theme = {
59
55
  }
60
56
  ```
61
57
 
62
- ## noStyle Mode
58
+ ## When to Use Raw className
59
+
60
+ Use raw className-level styling when:
61
+
62
+ * your styling system is already class-driven
63
+ * tokens are too broad for the change
64
+ * slots already identify the correct element
63
65
 
64
- Use `noStyle` when you want to remove defaults and style from scratch:
66
+ If the request is "make the banner footer darker", prefer `theme.colors.surfaceHover` first. If the request is "add a border and spacing only to the footer", prefer `theme.slots.consentBannerFooter`.
67
+
68
+ ## Advanced: `noStyle`
69
+
70
+ Use `noStyle` only when you want to remove defaults and style from scratch while still keeping c15t's component structure:
65
71
 
66
72
  ```tsx
67
73
  {/* Remove all styles from a specific component */}
@@ -81,4 +87,6 @@ const theme = {
81
87
  } satisfies Theme;
82
88
  ```
83
89
 
90
+ Treat `noStyle` as an advanced escape hatch. Do not jump to it just because a token or slot needs debugging.
91
+
84
92
  For full custom markup and behavior, continue to [Headless Mode](../headless).