Big News: Socket Selected for OpenAI's Cybersecurity Grant Program.Details
Socket
Book a DemoSign in
Socket

@palmabit/react-cookie-law

Package Overview
Dependencies
Maintainers
4
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@palmabit/react-cookie-law

React Cookie banner GDPR compliance

latest
Source
npmnpm
Version
0.7.1
Version published
Weekly downloads
519
3.59%
Maintainers
4
Weekly downloads
 
Created
Source

npm version Build Status Coverage Status

A React Cookie Banner component GDPR compliance.

Preview

Install


yarn add @palmabit/react-cookie-law

or


npm install --save @palmabit/react-cookie-law

Usage

import { CookieBanner } from "@palmabit/react-cookie-law";

React.renderComponent(
  <div>
    <CookieBanner
      message="Cookie banner message"
      wholeDomain={true}
      onAccept={() => {}}
      onAcceptPreferences={() => {}}
      onAcceptStatistics={() => {}}
      onAcceptMarketing={() => {}}
    />
  </div>,

  document.body
);

Options

NameTypeDefaultDescription
classNamestringoptional. Classes
messagestringRequired. Custom text of the banner
wholeDomainboolfalseoptional. Enable or disable the root path '/' option when a cookie is set
policyLinkstring"/#"optional. Link to privacy policy page
privacyPolicyLinkTextstring"Privacy Policy"optional. Text for the privacy policy link
necessaryOptionTextstring"Necessary"optional. Text for the necessary cookies checkbox
preferencesOptionTextstring"Preferences"optional. Text for the preferences cookies checkbox
statisticsOptionTextstring"Statistics"optional. Text for the statistics cookies checkbox
marketingOptionTextstring"Marketing"optional. Text for the marketing cookies checkbox
acceptButtonTextstring"Accept"optional. Text for the accept button
declineButtonTextstring"Decline"optional. Text for the decline button
managePreferencesButtonTextstring"Decline"optional. Text for the manage preferences button
savePreferencesButtonTextstring"Decline"optional. Text for the save and close* button
showDeclineButtonboolfalseoptional. Show or hide the decline button
dismissOnScrollboolfalseoptional. Enable or disable the dismissing on scroll of the banner
showPreferencesOptionbooltrueoptional. Show or hide the preferences checkbox
showStatisticsOptionbooltrueoptional. Show or hide the statistics checkbox
showMarketingOptionbooltrueoptional. Show or hide the marketing checkbox
preferencesDefaultCheckedbooltrueoptional. Check the preferences checkbox as default
statisticsDefaultCheckedbooltrueoptional. Check the statistics checkbox as default
marketingDefaultCheckedbooltrueoptional. Check the marketing checkbox as default
onAcceptfunctionFunctionoptional. Callback called when the consent is given
onAcceptPreferencesfunctionFunctionoptional. Callback called if preferences cookies is accepted
onAcceptStatisticsfunctionFunctionoptional. Callback called if statistics cookies is accepted
onAcceptMarketingfunctionFunctionoptional. Callback called if marketing cookies is accepted
onDeclinePreferencesfunctionFunctionoptional. Callback called if preferences cookies is declined
onDeclineStatisticsfunctionFunctionoptional. Callback called if statistics cookies is declined
onDeclineMarketingfunctionFunctionoptional. Callback called if marketing cookies is declined
coryphaUserIdstring"1"optional. User ID of the current user
coryphaDocumentCodestring"my-app"*optional**. The unique document code assigned to the application
coryphaDocumentLanguagestring"en"*optional**. Callback called if *marketing* cookies is declined
coryphaApiKeystring"12345678-abcd-dcba-abcd-1234567890ab"*optional**. Your Corypha API Key
onAcceptCoryphaPreferencesfunctionFunctionoptional. Callback called when Corypha cookies are accepted
onDeclineCoryphaPreferencesfunctionFunctionoptional. Callback called when Corypha cookies are declined

*NOTE: coryphaDocumentCode, coryphaDocumentLanguage and coryphaApiKey are required when setting up the Corypha integration.

Style

<CookieBanner
  message="Cookie banner message"
  styles={{
    dialog: { backgroundColor: "red" },
  }}
/>
Style optionDescription
dialogStyle that override .react-cookie-law-dialog class
container.react-cookie-law-container class
messageStyle for banner text (.react-cookie-law-message class)
policyStyle for cookie policy link (.react-cookie-law-policy class)
selectPaneStyle for select pane (.react-cookie-law-select-pane class)
optionWrapperStyle for option checkbox wrapper (.react-cookie-law-option-wrapper class)
optionLabelStyle for the text of checkbox labels
checkboxStyle for checkboxes (.react-cookie-law-option-checkbox class)
buttonWrapperStyle for buttons wrapper (.react-cookie-law-dialog class)
buttonStyle for buttons (.react-cookie-law-dialog class)

Test


yarn test

or


npm test

Author

Palmabit

Licence

See the MIT License

Keywords

gdpr

FAQs

Package last updated on 17 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts