Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eisberg-labs/mui-next-cookie-consent

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eisberg-labs/mui-next-cookie-consent

React Material Ui cookie consent dialog, compatible with nextjs cookies.

  • 3.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

React Material Ui cookie consent dialog, compatible with Nextjs cookies.

Installation

Since this is an extension of mui components, prerequisite is to have material library already installed.

npm i --save @mui/material
npm i --save @eisberg-labs/mui-next-cookie-consent

Usage

Just import the template with defaults:

<CookieConsent>This website uses cookies to enhance the user experience.</CookieConsent>

I use it in a nextjs app like this:


const CookieConsent = dynamic(() => import('@eisberg-labs/mui-next-cookie-consent'), {suspense: true});

export default function Layout({ children }) {
  return (
    <>
      <AppHeader />
      <div className={styles.wrapper}>{children}</div>
      <Suspense><CookieConsent
        cookieOptions={{
          expires: moment().add(1, 'years').toDate()
        }}
        confirmText="I agree"
      >This website uses cookies to enhance the user experience.</CookieConsent></Suspense>
      <Footer />
    </>
  );
}

You can change the default styling, cookie key, set expires, register callback on Accept.

Api

NameTypeDefaultDescription
defaultNamestring'CookieConsent'Cookie key name for cookie consent
confirmTextReact.ReactNode'I understand'Confirm button text
buttonVariant'text', 'outlined', 'contained''text'Button variant
cookieOptionsCookieSerializeOptionse.g. {expires: moment().add(1, 'days').toDate()}
onAccept()=>voidOptional function that triggers after cookie consent accepted.
sxSxPropsDefine styling of the cookie consent container
butttonSxSxPropsDefine styling of the button.

License

MIT © Eisberg Labs

Keywords

FAQs

Package last updated on 03 Jan 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc