Iframe Blocking
Embedded iframes from third parties (YouTube, Google Maps, social media widgets) can set cookies and track users without their consent. c15t provides two approaches to gate iframes behind consent:
<Frame>component - A React component that conditionally renders children based on consent- HTML
data-categoryattribute - For raw<iframe>elements outside of React
Custom Placeholder
Replace the default placeholder with your own UI:
Compound Components
Build custom placeholder layouts using compound components:
HTML Attribute Approach
For iframes outside of React (e.g., CMS content, server-rendered HTML), add data-category and use data-src instead of src:
When consent for the specified category is granted, c15t automatically swaps data-src to src, loading the iframe. When consent is revoked, src is moved back to data-src.
Dynamic Iframes
c15t uses a MutationObserver to watch for dynamically added iframes. Any iframe with data-category added to the DOM after initialization is automatically processed.