A React library for cookie consent management compliant with Brazil's LGPD.
Installation β’ Basic Usage β’ π Quickstart β’ Documentation β’ Contributing
Start here: follow the Quickstart guide (QUICKSTART.en.md) for step-by-step setup, TypeScript examples, props summary and MUI integration β recommended for new users.
npm install react-lgpd-consent @mui/material @emotion/react @emotion/styled js-cookie
Peer dependencies: react
, react-dom
, @mui/material
and js-cookie
.
Wrap your app with ConsentProvider
(minimal example):
import { ConsentProvider } from 'react-lgpd-consent'
export default function App() {
return (
<ConsentProvider categories={{ enabledCategories: ['analytics'] }}>
<YourApp />
</ConsentProvider>
)
}
customCategories
support β see the βCustom categories (customCategories)β section in the Quickstart.designTokens.layout.backdrop: 'auto'
for a theme-aware blocking banner backdrop.categories.enabledCategories
for clarity.policyLinkUrl
and/or termsLinkUrl
point to the current page, the blocking overlay is not applied β ensuring readability of these pages.In development, the library prints a guidance panel in the console to help you configure correctly:
setPreference
and ScriptIntegration.category
now use string
instead of Category
DEVELOPMENT.md
to submit a PR.MIT β see the LICENSE
file.