Consent Manager Widget
A flexible, composable widget for building custom privacy consent interfaces. The widget provides granular control over privacy preferences while handling all the compliance requirements for you.
The Consent Manager Widget serves as the core interface for detailed privacy consent management in your application. While the Cookie Banner handles initial consent, this widget enables users to fine-tune their privacy preferences through an intuitive accordion interface.
Understanding the Widget
Think of the Consent Manager Widget as a highly customizable form that gives users control over their privacy choices. It organizes different types of data collection and processing into collapsible sections, making it easy for users to understand and manage their consent preferences.
For example, a typical widget might include sections for:
- Essential cookies that keep your site running
- Analytics that help improve user experience
- Marketing features that enable personalized content
- Third-party integrations that enhance functionality
The widget automatically handles the complex task of tracking and storing these preferences while maintaining compliance with privacy regulations.
Quick Start
First, install the package:
Then add the widget to your application:
Component Architecture
The Consent Manager Widget uses a compound component pattern, which means it's built from smaller, specialized components that work together. This approach gives you complete control over the widget's structure and appearance.
Let's break down the main building blocks:
Root Component
The ConsentManagerWidget
serves as the container and context provider for all other components:
Accordion Interface
The accordion interface organizes privacy preferences into expandable sections:
Custom Accordion Items
You can create custom sections for specific types of consent:
Action Buttons
The widget includes several pre-built buttons for common actions:
Customization
The widget supports several ways to customize its appearance and behavior:
Theme Customization
Apply custom styles using the theme prop:
Custom Layouts
Create completely custom layouts while maintaining functionality:
Branding
Control the visibility of c15t.com branding:
Accessibility
The Consent Manager Widget is built with accessibility in mind:
- Proper ARIA attributes for accordion sections
- Keyboard navigation support
- Focus management within the widget
- Screen reader announcements for state changes
- High contrast support for all interactive elements
All these accessibility features work automatically, ensuring all users can effectively manage their privacy preferences.
API Reference
Main Component Props
Prop | Type | Description | Default |
---|---|---|---|
theme | ConsentManagerWidgetTheme | Theme configuration object | |
hideBranding | boolean | Controls c15t.com branding visibility | false |
Available Sub-components
Each sub-component inherits theme support and provides specific functionality:
Component | Purpose | Key Props |
---|---|---|
Accordion | Container for consent options | type, value, onValueChange |
AccordionItems | Pre-built consent sections | - |
Switch | Toggle for individual consents | name, value, onChange |
Footer | Action button container | className, children |
SaveButton | Saves current preferences | onClick, disabled |
Integration Examples
With Custom Components
With Consent Manager Dialog
Best Practices
- Place the widget in a dedicated privacy preferences page or dialog
- Use clear, concise labels for consent options
- Maintain consistent styling with your application
- Test the widget across different screen sizes
- Ensure all interactive elements are keyboard accessible