@c15t/nextjs 2.2.0 → 3.0.0-alpha.0

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 (220) hide show
  1. package/AGENTS.md +102 -142
  2. package/README.md +4 -4
  3. package/dist/api.js +1 -0
  4. package/dist/config.js +1 -0
  5. package/dist/devtools.js +2 -0
  6. package/dist/headers.js +1 -0
  7. package/dist/iab/styles.css +1 -1
  8. package/dist/iab/styles.tw3.css +133 -19
  9. package/dist/index.js +1 -1
  10. package/dist/middleware.js +1 -0
  11. package/dist/node-bridge.js +1 -0
  12. package/dist/pages.js +1 -0
  13. package/dist/proxy.js +1 -0
  14. package/dist/root.js +2 -0
  15. package/dist/server.js +1 -0
  16. package/dist/static.js +1 -0
  17. package/dist/styles.css +1 -1
  18. package/dist/styles.tw3.css +173 -29
  19. package/dist/version.js +1 -1
  20. package/dist-types/api.d.ts +88 -0
  21. package/dist-types/config.d.ts +110 -0
  22. package/dist-types/devtools.d.ts +1 -0
  23. package/dist-types/headers.d.ts +4 -0
  24. package/dist-types/index.d.ts +28 -10
  25. package/dist-types/middleware.d.ts +15 -0
  26. package/dist-types/node-bridge.d.ts +57 -0
  27. package/dist-types/pages.d.ts +88 -0
  28. package/dist-types/proxy.d.ts +34 -0
  29. package/dist-types/root.d.ts +86 -0
  30. package/dist-types/server.d.ts +164 -0
  31. package/dist-types/static.d.ts +42 -0
  32. package/dist-types/types.d.ts +5 -36
  33. package/dist-types/version.d.ts +1 -1
  34. package/docs/README.md +102 -142
  35. package/docs/assets/v3/brand-bar.png +0 -0
  36. package/docs/assets/v3/brand-card.png +0 -0
  37. package/docs/assets/v3/choice-wall.png +0 -0
  38. package/docs/assets/v3/mobile-card.png +0 -0
  39. package/docs/assets/v3/preferences.png +0 -0
  40. package/docs/customization/overview.md +45 -0
  41. package/docs/customization/recipes.md +79 -0
  42. package/docs/customization/slots.md +55 -0
  43. package/docs/customization/tokens.md +76 -0
  44. package/docs/customization/translations.md +49 -0
  45. package/docs/frameworks/next/api-reference/data-fetching.md +416 -0
  46. package/docs/frameworks/next/app-router.md +403 -0
  47. package/docs/frameworks/next/client-side.md +118 -0
  48. package/docs/frameworks/next/components/consent-banner.md +251 -211
  49. package/docs/frameworks/next/components/consent-dialog-link.md +96 -35
  50. package/docs/frameworks/next/components/consent-dialog-trigger.md +74 -149
  51. package/docs/frameworks/next/components/consent-dialog.md +189 -134
  52. package/docs/frameworks/next/components/consent-manager-provider.md +60 -318
  53. package/docs/frameworks/next/components/consent-widget.md +172 -114
  54. package/docs/frameworks/next/components/dev-tools.md +199 -40
  55. package/docs/frameworks/next/components/frame.md +137 -42
  56. package/docs/frameworks/next/concepts/consent-categories.md +24 -89
  57. package/docs/frameworks/next/concepts/policy-presets.md +142 -0
  58. package/docs/frameworks/next/content-security-policy.md +189 -0
  59. package/docs/frameworks/next/data-fetching.md +74 -0
  60. package/docs/frameworks/next/geography-headers.md +251 -0
  61. package/docs/frameworks/next/headless.md +95 -185
  62. package/docs/frameworks/next/hooks/use-consent-manager/overview.md +42 -163
  63. package/docs/frameworks/next/iab/overview.md +37 -107
  64. package/docs/frameworks/next/optimization.md +158 -194
  65. package/docs/frameworks/next/pages-router.md +296 -0
  66. package/docs/frameworks/next/quickstart.md +31 -132
  67. package/docs/frameworks/next/script-loader.md +134 -467
  68. package/docs/frameworks/next/server-side.md +97 -130
  69. package/docs/frameworks/next/static-export.md +164 -0
  70. package/docs/frameworks/next/styling/overview.md +166 -250
  71. package/docs/frameworks/next/troubleshooting.md +134 -144
  72. package/docs/guides/consent-state.md +60 -0
  73. package/docs/guides/data-fetching.md +163 -0
  74. package/docs/guides/deployment-modes.md +63 -0
  75. package/docs/guides/troubleshooting.md +68 -0
  76. package/docs/guides/verify-consent.md +62 -0
  77. package/docs/integrations/adobe-analytics.md +239 -105
  78. package/docs/integrations/ahrefs-analytics.md +238 -104
  79. package/docs/integrations/amplitude.md +219 -157
  80. package/docs/integrations/building-integrations.md +32 -224
  81. package/docs/integrations/clearbit.md +247 -86
  82. package/docs/integrations/cloudflare-web-analytics.md +250 -84
  83. package/docs/integrations/crisp.md +251 -97
  84. package/docs/integrations/databuddy.md +259 -153
  85. package/docs/integrations/fathom-analytics.md +239 -96
  86. package/docs/integrations/google-maps.md +328 -207
  87. package/docs/integrations/google-tag-manager.md +248 -96
  88. package/docs/integrations/google-tag.md +261 -90
  89. package/docs/integrations/heap.md +222 -149
  90. package/docs/integrations/hightouch.md +225 -131
  91. package/docs/integrations/hotjar.md +239 -90
  92. package/docs/integrations/intercom.md +239 -98
  93. package/docs/integrations/linkedin-insights.md +243 -113
  94. package/docs/integrations/logrocket.md +241 -123
  95. package/docs/integrations/matomo-analytics.md +256 -111
  96. package/docs/integrations/meta-pixel.md +197 -324
  97. package/docs/integrations/microsoft-clarity.md +233 -114
  98. package/docs/integrations/microsoft-uet.md +245 -110
  99. package/docs/integrations/mixpanel-analytics.md +252 -87
  100. package/docs/integrations/openai-pixel.md +441 -0
  101. package/docs/integrations/overview.md +95 -133
  102. package/docs/integrations/pirsch.md +249 -96
  103. package/docs/integrations/plausible-analytics.md +241 -100
  104. package/docs/integrations/posthog.md +353 -214
  105. package/docs/integrations/promptwatch.md +251 -81
  106. package/docs/integrations/reddit-pixel.md +226 -173
  107. package/docs/integrations/rudderstack.md +244 -187
  108. package/docs/integrations/rybbit-analytics.md +244 -91
  109. package/docs/integrations/segment.md +238 -92
  110. package/docs/integrations/snapchat-pixel.md +240 -110
  111. package/docs/integrations/tiktok-pixel.md +249 -81
  112. package/docs/integrations/umami-analytics.md +242 -95
  113. package/docs/integrations/vercel-analytics.md +242 -90
  114. package/docs/integrations/x-pixel.md +238 -104
  115. package/docs/integrations/youtube.md +354 -142
  116. package/docs/upgrade-v3.md +334 -0
  117. package/iab/styles.css +1 -1
  118. package/iab/styles.tw3.css +1 -1
  119. package/package.json +106 -65
  120. package/readme.json +3 -3
  121. package/src/iab/styles.css +1 -1
  122. package/src/iab/styles.tw3.css +1 -1
  123. package/src/styles.css +1 -1
  124. package/src/styles.tw3.css +1 -1
  125. package/styles.css +1 -1
  126. package/styles.tw3.css +1 -1
  127. package/client/components/consent-dialog-link.js +0 -3
  128. package/client/components/integrations.js +0 -3
  129. package/dist/components/integrations/index.cjs +0 -1
  130. package/dist/components/integrations/index.js +0 -1
  131. package/dist/headless.cjs +0 -1
  132. package/dist/index.cjs +0 -1
  133. package/dist/libs/browser-initial-data.cjs +0 -1
  134. package/dist/libs/browser-initial-data.js +0 -1
  135. package/dist/libs/initial-data.cjs +0 -1
  136. package/dist/libs/initial-data.js +0 -1
  137. package/dist/types.cjs +0 -1
  138. package/dist/version.cjs +0 -1
  139. package/dist-types/components/integrations/index.d.ts +0 -1
  140. package/dist-types/libs/browser-initial-data.d.ts +0 -9
  141. package/dist-types/libs/initial-data.d.ts +0 -33
  142. package/docs/frameworks/next/building-headless-components.md +0 -379
  143. package/docs/frameworks/next/callbacks.md +0 -186
  144. package/docs/frameworks/next/concepts/client-modes.md +0 -177
  145. package/docs/frameworks/next/concepts/consent-models.md +0 -117
  146. package/docs/frameworks/next/concepts/cookie-management.md +0 -122
  147. package/docs/frameworks/next/concepts/glossary.md +0 -24
  148. package/docs/frameworks/next/concepts/initialization-flow.md +0 -149
  149. package/docs/frameworks/next/concepts/policy-packs.md +0 -230
  150. package/docs/frameworks/next/hooks/use-color-scheme.md +0 -41
  151. package/docs/frameworks/next/hooks/use-consent-manager/checking-consent.md +0 -96
  152. package/docs/frameworks/next/hooks/use-consent-manager/location-info.md +0 -97
  153. package/docs/frameworks/next/hooks/use-consent-manager/setting-consent.md +0 -94
  154. package/docs/frameworks/next/hooks/use-draggable.md +0 -59
  155. package/docs/frameworks/next/hooks/use-focus-trap.md +0 -42
  156. package/docs/frameworks/next/hooks/use-reduced-motion.md +0 -37
  157. package/docs/frameworks/next/hooks/use-ssr-status.md +0 -32
  158. package/docs/frameworks/next/hooks/use-text-direction.md +0 -50
  159. package/docs/frameworks/next/hooks/use-translations.md +0 -55
  160. package/docs/frameworks/next/iab/consent-banner.md +0 -91
  161. package/docs/frameworks/next/iab/consent-dialog.md +0 -129
  162. package/docs/frameworks/next/iab/use-gvl-data.md +0 -21
  163. package/docs/frameworks/next/iframe-blocking.md +0 -106
  164. package/docs/frameworks/next/internationalization.md +0 -207
  165. package/docs/frameworks/next/network-blocker.md +0 -140
  166. package/docs/frameworks/next/policy-packs.md +0 -248
  167. package/docs/frameworks/next/styling/classnames.md +0 -94
  168. package/docs/frameworks/next/styling/color-scheme.md +0 -84
  169. package/docs/frameworks/next/styling/css-variables.md +0 -53
  170. package/docs/frameworks/next/styling/slots.md +0 -94
  171. package/docs/frameworks/next/styling/tailwind.md +0 -137
  172. package/docs/frameworks/next/styling/tokens.md +0 -156
  173. package/docs/shared/concepts/client-modes.md +0 -103
  174. package/docs/shared/concepts/consent-categories.md +0 -41
  175. package/docs/shared/concepts/consent-models.md +0 -72
  176. package/docs/shared/concepts/cookie-management.md +0 -88
  177. package/docs/shared/concepts/glossary.md +0 -24
  178. package/docs/shared/concepts/initialization-flow.md +0 -105
  179. package/docs/shared/concepts/policy-packs.md +0 -225
  180. package/docs/shared/react/components/consent-banner.md +0 -242
  181. package/docs/shared/react/components/consent-dialog-link.md +0 -45
  182. package/docs/shared/react/components/consent-dialog-trigger.md +0 -185
  183. package/docs/shared/react/components/consent-dialog.md +0 -119
  184. package/docs/shared/react/components/consent-manager-provider.md +0 -225
  185. package/docs/shared/react/components/consent-widget.md +0 -121
  186. package/docs/shared/react/components/dev-tools.md +0 -81
  187. package/docs/shared/react/components/frame.md +0 -52
  188. package/docs/shared/react/guides/building-headless-components.md +0 -110
  189. package/docs/shared/react/guides/callbacks.md +0 -89
  190. package/docs/shared/react/guides/headless.md +0 -31
  191. package/docs/shared/react/guides/iframe-blocking.md +0 -65
  192. package/docs/shared/react/guides/internationalization.md +0 -123
  193. package/docs/shared/react/guides/network-blocker.md +0 -72
  194. package/docs/shared/react/guides/optimization.md +0 -44
  195. package/docs/shared/react/guides/policy-packs.md +0 -173
  196. package/docs/shared/react/guides/script-loader.md +0 -311
  197. package/docs/shared/react/hooks/use-color-scheme.md +0 -31
  198. package/docs/shared/react/hooks/use-consent-manager/checking-consent.md +0 -95
  199. package/docs/shared/react/hooks/use-consent-manager/location-info.md +0 -96
  200. package/docs/shared/react/hooks/use-consent-manager/overview.md +0 -74
  201. package/docs/shared/react/hooks/use-consent-manager/setting-consent.md +0 -93
  202. package/docs/shared/react/hooks/use-draggable.md +0 -30
  203. package/docs/shared/react/hooks/use-focus-trap.md +0 -20
  204. package/docs/shared/react/hooks/use-reduced-motion.md +0 -33
  205. package/docs/shared/react/hooks/use-ssr-status.md +0 -16
  206. package/docs/shared/react/hooks/use-text-direction.md +0 -38
  207. package/docs/shared/react/hooks/use-translations.md +0 -15
  208. package/docs/shared/react/iab/consent-banner.md +0 -60
  209. package/docs/shared/react/iab/consent-dialog.md +0 -76
  210. package/docs/shared/react/iab/overview.md +0 -80
  211. package/docs/shared/react/iab/use-gvl-data.md +0 -21
  212. package/docs/shared/react/styling/classnames.md +0 -93
  213. package/docs/shared/react/styling/color-scheme.md +0 -35
  214. package/docs/shared/react/styling/css-variables.md +0 -53
  215. package/docs/shared/react/styling/overview.md +0 -261
  216. package/docs/shared/react/styling/slots.md +0 -93
  217. package/docs/shared/react/styling/stylesheet-entrypoint.md +0 -8
  218. package/docs/shared/react/styling/tailwind.md +0 -88
  219. package/docs/shared/react/styling/tokens.md +0 -155
  220. package/docs/shared/troubleshooting.md +0 -82
@@ -1,242 +0,0 @@
1
- ---
2
- title: Consent Banner
3
- description: Reference page for consent banner.
4
- group: reference
5
- ---
6
- `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.
7
-
8
- ## Button Layout
9
-
10
- The `layout` prop controls button arrangement. Each item is either a button ID or an array of button IDs (which groups them together):
11
-
12
- ```tsx
13
- {/* Default: reject and accept grouped, customize separate */}
14
- <ConsentBanner layout={[['reject', 'accept'], 'customize']} />
15
-
16
- {/* All buttons in one group */}
17
- <ConsentBanner layout={[['reject', 'customize', 'accept']]} />
18
-
19
- {/* Accept first, then reject and customize grouped */}
20
- <ConsentBanner layout={['accept', ['reject', 'customize']]} />
21
- ```
22
-
23
- To stack groups vertically, pair the same grouped layout with `direction="column"`:
24
-
25
- ```tsx
26
- <ConsentBanner
27
- layout={['customize', ['reject', 'accept']]}
28
- direction="column"
29
- />
30
- ```
31
-
32
- ## Policy-Driven UI Profile
33
-
34
- When using backend runtime policies, `policy.ui.uiProfile` can control banner action presentation:
35
-
36
- * `compact` — default desktop sizing
37
- * `balanced` — auto-fills compact and grouped layouts with moderate emphasis
38
- * `strict` — always fills action controls for explicit, high-clarity layouts
39
-
40
- ## Theme-Level Button Styling
41
-
42
- Use the provider `theme` prop to control how stock consent actions look:
43
-
44
- ```tsx
45
- <ConsentManagerProvider
46
- options={{
47
- theme: {
48
- consentActions: {
49
- default: { mode: 'stroke' },
50
- accept: { variant: 'primary', mode: 'stroke' },
51
- customize: { variant: 'neutral', mode: 'ghost' },
52
- },
53
- },
54
- }}
55
- >
56
- <ConsentBanner />
57
- </ConsentManagerProvider>
58
- ```
59
-
60
- Policy packs control grouping, ordering, and direction. The theme controls button appearance.
61
-
62
- ## Styling First
63
-
64
- > ℹ️ **Info:**
65
- > 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.
66
-
67
- The stock banner maps common visual changes to the theme system:
68
-
69
- * Card background -> `theme.colors.surface`
70
- * Footer background -> `theme.colors.surfaceHover`
71
- * Card, footer, and title tweaks -> `theme.slots.consentBannerCard`, `consentBannerFooter`, and `consentBannerTitle`
72
-
73
- ```tsx
74
- <ConsentManagerProvider
75
- options={{
76
- theme: {
77
- colors: {
78
- surface: '#fffdf8',
79
- surfaceHover: '#f6f3ee',
80
- },
81
- slots: {
82
- consentBannerCard: 'rounded-[28px] shadow-xl',
83
- consentBannerFooter: 'border-t border-black/10 px-6',
84
- consentBannerTitle: 'tracking-tight',
85
- },
86
- },
87
- }}
88
- >
89
- <ConsentBanner />
90
- </ConsentManagerProvider>
91
- ```
92
-
93
- ### Primary Button
94
-
95
- Highlight specific button(s) as the primary action:
96
-
97
- ```tsx
98
- {/* Single primary */}
99
- <ConsentBanner primaryButton="accept" />
100
-
101
- {/* Multiple primaries */}
102
- <ConsentBanner primaryButton={['accept', 'customize']} />
103
- ```
104
-
105
- ## Legal Links
106
-
107
- Control which legal links appear in the banner description:
108
-
109
- ```tsx
110
- {/* Show all configured links (default) */}
111
- <ConsentBanner legalLinks={undefined} />
112
-
113
- {/* Show no links */}
114
- <ConsentBanner legalLinks={null} />
115
-
116
- {/* Show specific links */}
117
- <ConsentBanner legalLinks={['privacyPolicy', 'cookiePolicy']} />
118
- ```
119
-
120
- > ℹ️ **Info:**
121
- > Legal link URLs are configured in the ConsentManagerProvider options via the legalLinks prop, not on the banner itself.
122
-
123
- ## Customizing Copy
124
-
125
- Prefer provider `i18n` when you want to rename the stock banner content:
126
-
127
- ```tsx
128
- <ConsentManagerProvider
129
- options={{
130
- i18n: {
131
- locale: 'en',
132
- messages: {
133
- en: {
134
- cookieBanner: {
135
- title: 'We value your privacy',
136
- description: 'We use cookies to improve the site and measure performance.',
137
- },
138
- common: {
139
- acceptAll: 'Accept all',
140
- rejectAll: 'Reject all',
141
- customize: 'Manage preferences',
142
- },
143
- },
144
- },
145
- },
146
- }}
147
- >
148
- <ConsentBanner />
149
- </ConsentManagerProvider>
150
- ```
151
-
152
- 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.
153
-
154
- ## Advanced: Compound Components
155
-
156
- Use compound components only when the stock banner structure is no longer enough and you need to rearrange existing c15t primitives while keeping policy-driven action grouping and emphasis:
157
-
158
- ```tsx
159
- <ConsentBanner.Root>
160
- <ConsentBanner.Overlay />
161
- <ConsentBanner.Card>
162
- <ConsentBanner.Header>
163
- <ConsentBanner.Title />
164
- <ConsentBanner.Description />
165
- </ConsentBanner.Header>
166
- <ConsentBanner.PolicyActions />
167
- </ConsentBanner.Card>
168
- </ConsentBanner.Root>
169
- ```
170
-
171
- * `ConsentBanner.Root` — Outermost container, provides theme context
172
- * `ConsentBanner.Card` — Main content card with optional focus trapping
173
- * `ConsentBanner.Header` — Contains title and description
174
- * `ConsentBanner.Title` — Heading, defaults to translation `consentBanner.title`
175
- * `ConsentBanner.Description` — Description text, supports `legalLinks` prop
176
- * `ConsentBanner.PolicyActions` — Renders policy-aware grouped actions inside the banner footer
177
- * `ConsentBanner.Footer` — Action buttons container
178
- * `ConsentBanner.FooterSubGroup` — Groups related buttons together
179
- * `ConsentBanner.RejectButton` — Rejects all consent
180
- * `ConsentBanner.CustomizeButton` — Opens the consent dialog
181
- * `ConsentBanner.AcceptButton` — Accepts all consent
182
- * `ConsentBanner.Overlay` — Optional backdrop overlay
183
-
184
- For a fixed layout that intentionally ignores policy grouping, render the footer manually:
185
-
186
- ```tsx
187
- <ConsentBanner.Root>
188
- <ConsentBanner.Card>
189
- <ConsentBanner.Header>
190
- <ConsentBanner.Title />
191
- <ConsentBanner.Description />
192
- </ConsentBanner.Header>
193
- <ConsentBanner.Footer>
194
- <ConsentBanner.FooterSubGroup>
195
- <ConsentBanner.RejectButton />
196
- <ConsentBanner.AcceptButton />
197
- </ConsentBanner.FooterSubGroup>
198
- <ConsentBanner.CustomizeButton />
199
- </ConsentBanner.Footer>
200
- </ConsentBanner.Card>
201
- </ConsentBanner.Root>
202
- ```
203
-
204
- ## Using `renderAction` with c15t Defaults
205
-
206
- `ConsentBanner.PolicyActions` renders stock c15t buttons and translations by default.
207
-
208
- ```tsx
209
- <ConsentBanner.PolicyActions />
210
- ```
211
-
212
- `renderAction` is optional. When you want custom mapping but still want the built-in c15t button behavior and copy, return the stock button compounds:
213
-
214
- ```tsx
215
- <ConsentBanner.PolicyActions
216
- renderAction={(action, props) => {
217
- const { key, ...buttonProps } = props
218
-
219
- switch (action) {
220
- case 'accept':
221
- return <ConsentBanner.AcceptButton key={key} {...buttonProps} />
222
- case 'reject':
223
- return <ConsentBanner.RejectButton key={key} {...buttonProps} />
224
- case 'customize':
225
- return <ConsentBanner.CustomizeButton key={key} {...buttonProps} />
226
- }
227
- }}
228
- />
229
- ```
230
-
231
- `renderAction` is still meant for stock button compounds. If you want completely custom button elements and click handling, use `useHeadlessConsentUI()` and render `banner.actionGroups` manually instead of `ConsentBanner.PolicyActions`.
232
-
233
- If you only need styling changes, stay with tokens and slots instead of rebuilding the banner layout.
234
-
235
- ## Props
236
-
237
- |Property|Value|
238
- |:--|:--|
239
- |Type Name|\`ConsentBannerProps\`|
240
- |Source Path|\`./packages/react/src/components/consent-banner/consent-banner.tsx\`|
241
-
242
- \*ExtractedTypeTable: Could not extract "ConsentBannerProps" from "./packages/react/src/components/consent-banner/consent-banner.tsx" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
@@ -1,45 +0,0 @@
1
- ---
2
- title: Consent Dialog Link
3
- description: Reference page for consent dialog link.
4
- group: reference
5
- ---
6
- `ConsentDialogLink` is an inline trigger for opening the consent dialog from places like site footers, legal pages, or account settings. It is unstyled by default, so it inherits your app's typography and link/button styles.
7
-
8
- ## Footer Link (unstyled by default)
9
-
10
- ```tsx
11
- <footer>
12
- <ConsentDialogLink>
13
- Your privacy settings
14
- </ConsentDialogLink>
15
- </footer>
16
- ```
17
-
18
- ## Render as an Anchor
19
-
20
- Use `asChild` to keep semantic anchor markup while still opening the dialog:
21
-
22
- ```tsx
23
- <ConsentDialogLink asChild>
24
- <a href="#privacy-settings">Manage Preferences</a>
25
- </ConsentDialogLink>
26
- ```
27
-
28
- ## Optional Styling Control
29
-
30
- The component defaults to `noStyle={true}`. Set it to `false` if you want c15t button styles:
31
-
32
- ```tsx
33
- <ConsentDialogLink noStyle={false}>
34
- Privacy Settings
35
- </ConsentDialogLink>
36
- ```
37
-
38
- ## Props
39
-
40
- |Property|Value|
41
- |:--|:--|
42
- |Type Name|\`ConsentDialogLinkProps\`|
43
- |Source Path|\`./packages/react/src/components/consent-preferences-link/consent-preferences-link.tsx\`|
44
-
45
- \*ExtractedTypeTable: Could not extract "ConsentDialogLinkProps" from "./packages/react/src/components/consent-preferences-link/consent-preferences-link.tsx" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
@@ -1,185 +0,0 @@
1
- ---
2
- title: Consent Dialog Trigger
3
- description: Reference page for consent dialog trigger.
4
- group: reference
5
- ---
6
- `ConsentDialogTrigger` is a floating button that opens the consent dialog when clicked. Users can drag it to any corner of the screen, and the position persists across sessions. Use it to give users a persistent way to manage their privacy settings.
7
-
8
- ## Icon Options
9
-
10
- ```tsx
11
- {/* Built-in icons */}
12
- <ConsentDialogTrigger icon="branding" /> {/* c15t logo (default) */}
13
- <ConsentDialogTrigger icon="fingerprint" /> {/* Privacy icon */}
14
- <ConsentDialogTrigger icon="settings" /> {/* Gear icon */}
15
-
16
- {/* Custom icon */}
17
- <ConsentDialogTrigger icon={<MyCustomIcon />} />
18
- ```
19
-
20
- ## Configurable Toolbar
21
-
22
- Use the separate `ConsentDialogTriggerToolbar` when you want to place app-owned controls beside the privacy trigger. It always renders exactly one built-in action that opens consent preferences, so `actions` only contains controls your app owns.
23
-
24
- ```tsx
25
- <ConsentDialogTriggerToolbar
26
- ariaLabel="Site controls"
27
- actions={[
28
- {
29
- id: 'theme',
30
- label: isDark ? 'Switch to light theme' : 'Switch to dark theme',
31
- icon: isDark ? <SunIcon /> : <MoonIcon />,
32
- pressed: isDark,
33
- onSelect: toggleColorScheme,
34
- },
35
- {
36
- id: 'support',
37
- label: 'Open support chat',
38
- icon: <ChatIcon />,
39
- onSelect: openSupportChat,
40
- },
41
- ]}
42
- preferences={{
43
- icon: 'fingerprint',
44
- label: 'Manage privacy settings',
45
- }}
46
- />
47
- ```
48
-
49
- Each custom action requires a stable `id`, accessible `label`, `icon`, and `onSelect` callback. Use `pressed` for toggle actions and `disabled` for unavailable actions. Your app remains responsible for state, integrations, and changing the icon or label. The preferences action automatically moves to the edge nearest the toolbar's snapped corner while custom actions keep their configured order.
50
-
51
- Toolbars are horizontal by default. Set `orientation="vertical"` to stack the actions and enable Up/Down arrow-key navigation:
52
-
53
- ```tsx
54
- <ConsentDialogTriggerToolbar
55
- orientation="vertical"
56
- actions={toolbarActions}
57
- />
58
- ```
59
-
60
- ### Toolbar Styling
61
-
62
- The toolbar follows the standard styling precedence: internal CSS module styles, provider theme slots, then direct component overrides. Use `className` and `style` on the toolbar, or on an individual action, and use `noStyle` for a fully custom implementation.
63
-
64
- ```tsx
65
- <ConsentManagerProvider
66
- options={{
67
- theme: {
68
- slots: {
69
- consentDialogTriggerToolbar: 'my-toolbar',
70
- consentDialogTriggerToolbarItem: 'my-toolbar-item',
71
- consentDialogTriggerToolbarIcon: 'my-toolbar-icon',
72
- },
73
- },
74
- }}
75
- >
76
- <ConsentDialogTriggerToolbar
77
- className="fixed-toolbar"
78
- style={{ '--cdtt-offset': '24px' }}
79
- actions={[
80
- {
81
- id: 'support',
82
- label: 'Open support chat',
83
- icon: <ChatIcon />,
84
- onSelect: openSupportChat,
85
- className: 'support-action',
86
- },
87
- ]}
88
- />
89
- </ConsentManagerProvider>
90
- ```
91
-
92
- Available toolbar theme slots are `consentDialogTriggerToolbar`, `consentDialogTriggerToolbarItem`, and `consentDialogTriggerToolbarIcon`.
93
-
94
- With `noStyle`, use `data-corner`, `data-dragging`, and `data-snapping` on the toolbar to style its current position and interaction state.
95
-
96
- ## Visibility
97
-
98
- Control when the trigger is visible:
99
-
100
- ```tsx
101
- {/* Always visible (default) */}
102
- <ConsentDialogTrigger showWhen="always" />
103
-
104
- {/* Only after user has made a consent choice */}
105
- <ConsentDialogTrigger showWhen="after-consent" />
106
-
107
- {/* Hidden (control visibility programmatically) */}
108
- <ConsentDialogTrigger showWhen="never" />
109
- ```
110
-
111
- ## Position
112
-
113
- Set the default corner and control persistence:
114
-
115
- ```tsx
116
- <ConsentDialogTrigger
117
- defaultPosition="bottom-left"
118
- persistPosition={true} // Remembers user's drag position
119
- onPositionChange={(position) => console.log('Moved to:', position)}
120
- />
121
- ```
122
-
123
- ## Size
124
-
125
- ```tsx
126
- <ConsentDialogTrigger size="sm" /> {/* Small */}
127
- <ConsentDialogTrigger size="md" /> {/* Medium (default) */}
128
- <ConsentDialogTrigger size="lg" /> {/* Large */}
129
- ```
130
-
131
- ## Compound Components
132
-
133
- Build fully custom trigger layouts using sub-components:
134
-
135
- ```tsx
136
- <ConsentDialogTrigger.Root defaultPosition="bottom-right">
137
- <ConsentDialogTrigger.Button size="md">
138
- <ConsentDialogTrigger.Icon icon="settings" />
139
- <ConsentDialogTrigger.Text>Privacy</ConsentDialogTrigger.Text>
140
- </ConsentDialogTrigger.Button>
141
- </ConsentDialogTrigger.Root>
142
- ```
143
-
144
- * `ConsentDialogTrigger.Root` — Portal wrapper with drag handling and position persistence
145
- * `ConsentDialogTrigger.Button` — Draggable button element with size variants
146
- * `ConsentDialogTrigger.Icon` — Icon display (branding, fingerprint, settings, or custom)
147
- * `ConsentDialogTrigger.Text` — Optional text label
148
-
149
- ## Props
150
-
151
- ### ConsentDialogTrigger
152
-
153
- |Property|Value|
154
- |:--|:--|
155
- |Type Name|\`ConsentDialogTriggerProps\`|
156
- |Source Path|\`./packages/react/src/components/consent-dialog-trigger/types.ts\`|
157
-
158
- \*ExtractedTypeTable: Could not extract "ConsentDialogTriggerProps" from "./packages/react/src/components/consent-dialog-trigger/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
159
-
160
- ### ConsentDialogTriggerToolbar
161
-
162
- |Property|Value|
163
- |:--|:--|
164
- |Type Name|\`ConsentDialogTriggerToolbarProps\`|
165
- |Source Path|\`./packages/react/src/components/consent-dialog-trigger/types.ts\`|
166
-
167
- \*ExtractedTypeTable: Could not extract "ConsentDialogTriggerToolbarProps" from "./packages/react/src/components/consent-dialog-trigger/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
168
-
169
- ### Toolbar Actions
170
-
171
- |Property|Value|
172
- |:--|:--|
173
- |Type Name|\`ConsentDialogTriggerToolbarAction\`|
174
- |Source Path|\`./packages/react/src/components/consent-dialog-trigger/types.ts\`|
175
-
176
- \*ExtractedTypeTable: Could not extract "ConsentDialogTriggerToolbarAction" from "./packages/react/src/components/consent-dialog-trigger/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
177
-
178
- ### Preferences Action
179
-
180
- |Property|Value|
181
- |:--|:--|
182
- |Type Name|\`ConsentDialogTriggerToolbarPreferences\`|
183
- |Source Path|\`./packages/react/src/components/consent-dialog-trigger/types.ts\`|
184
-
185
- \*ExtractedTypeTable: Could not extract "ConsentDialogTriggerToolbarPreferences" from "./packages/react/src/components/consent-dialog-trigger/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
@@ -1,119 +0,0 @@
1
- ---
2
- title: Consent Dialog
3
- description: Reference page for consent dialog.
4
- group: reference
5
- ---
6
- `ConsentDialog` is a modal that shows toggles for each consent category. In **opt-in jurisdictions**, it typically opens when users click "Customize" on `ConsentBanner`. It can also be controlled programmatically for use on settings pages regardless of jurisdiction.
7
-
8
- ## Floating Trigger
9
-
10
- Add a floating button that lets users re-open the dialog after dismissing the banner:
11
-
12
- ```tsx
13
- {/* Default trigger */}
14
- <ConsentDialog showTrigger />
15
-
16
- {/* Custom trigger */}
17
- <ConsentDialog
18
- showTrigger={{
19
- icon: 'settings',
20
- defaultPosition: 'bottom-left',
21
- showWhen: 'after-consent',
22
- size: 'sm',
23
- }}
24
- />
25
- ```
26
-
27
- ## Branding
28
-
29
- Hide the c15t branding tag:
30
-
31
- ```tsx
32
- <ConsentDialog hideBranding />
33
- ```
34
-
35
- ## Styling First
36
-
37
- > ℹ️ **Info:**
38
- > 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, consentWidgetFooter, and consentDialogTag. See Styling Overview.
39
-
40
- ```tsx
41
- <ConsentManagerProvider
42
- options={{
43
- theme: {
44
- colors: {
45
- surface: '#fffdf8',
46
- surfaceHover: '#f6f3ee',
47
- },
48
- slots: {
49
- consentDialogCard: 'rounded-[32px] shadow-xl',
50
- consentDialogHeader: 'gap-3',
51
- consentWidgetFooter: 'gap-3 pt-6',
52
- consentDialogTag: 'shadow-none',
53
- },
54
- },
55
- }}
56
- >
57
- <ConsentDialog />
58
- </ConsentManagerProvider>
59
- ```
60
-
61
- Dialog copy should be changed through `ConsentManagerProvider.options.i18n`, not by rebuilding the dialog structure.
62
-
63
- ## Advanced: Compound Components
64
-
65
- Use compound components only when you need custom dialog markup while still keeping c15t primitives and policy-aware footer actions:
66
-
67
- ```tsx
68
- <ConsentDialog.Root>
69
- <ConsentDialog.Overlay />
70
- <ConsentDialog.Card>
71
- <ConsentDialog.Header>
72
- <ConsentDialog.HeaderTitle />
73
- <ConsentDialog.HeaderDescription />
74
- </ConsentDialog.Header>
75
- <ConsentDialog.Content>
76
- <ConsentWidget.Root>
77
- <ConsentWidget.Accordion type="single">
78
- <ConsentWidget.AccordionItems />
79
- </ConsentWidget.Accordion>
80
- <ConsentWidget.PolicyActions />
81
- </ConsentWidget.Root>
82
- </ConsentDialog.Content>
83
- <ConsentDialog.Footer />
84
- </ConsentDialog.Card>
85
- </ConsentDialog.Root>
86
- ```
87
-
88
- * `ConsentDialog.Root` — Portal container with focus trap, scroll lock, and animation
89
- * `ConsentDialog.Card` — Main dialog card
90
- * `ConsentDialog.Header` — Contains title and description
91
- * `ConsentDialog.HeaderTitle` — Dialog title
92
- * `ConsentDialog.HeaderDescription` — Description with optional `legalLinks`
93
- * `ConsentDialog.Content` — Main content area (typically contains `ConsentWidget`)
94
- * `ConsentDialog.Footer` — Footer with optional branding (`hideBranding` prop)
95
- * `ConsentDialog.Overlay` — Backdrop overlay
96
- * `ConsentWidget.PolicyActions` — Renders policy-aware grouped dialog actions
97
-
98
- For a quick pre-composed layout, use the shorthand card:
99
-
100
- ```tsx
101
- <ConsentDialog.Root>
102
- <ConsentDialog.ConsentCustomizationCard />
103
- </ConsentDialog.Root>
104
- ```
105
-
106
- `ConsentWidget.PolicyActions` uses stock c15t widget buttons and translations by default. Pass `renderAction` only when you need to customize the action mapping, and return stock widget button compounds if you want to preserve built-in behavior and copy.
107
-
108
- For fully manual control over dialog action rendering, use `useHeadlessConsentUI()` and map `dialog.actionGroups` yourself.
109
-
110
- If the stock dialog structure still works, prefer tokens, slots, and provider configuration instead.
111
-
112
- ## Props
113
-
114
- |Property|Value|
115
- |:--|:--|
116
- |Type Name|\`ConsentDialogProps\`|
117
- |Source Path|\`./packages/react/src/components/consent-dialog/consent-dialog.tsx\`|
118
-
119
- \*ExtractedTypeTable: Could not extract "ConsentDialogProps" from "./packages/react/src/components/consent-dialog/consent-dialog.tsx" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*