npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mihilista/cookie-consent

v3.0.2

Published

A reusable cookie consent manager designed specifically for Next.js projects. This package provides a flexible, developer-friendly solution for managing cookie consent, with pre-defined categories and the ability to extend it with custom categories and th

Downloads

768

Readme

Next.js Cookie Consent Manager 🍪

A reusable cookie consent manager designed specifically for Next.js projects. This package provides a flexible, developer-friendly solution for managing cookie consent, with pre-defined categories and the ability to extend it with custom categories and themes in the future. 🚀


✨ Features

  • Dynamic Cookie Categories: Pre-configured for analytics, marketing, and functional cookies.
  • Ready for Next.js: Built with Next.js best practices in mind.
  • Customizable: Future-ready for custom categories and themes.
  • Lightweight and Flexible: Easy to integrate and adapt to your needs.

📦 Installation

Install the package using npm:

npm install @mihilista/cookie-consent

or with Yarn:

yarn add @mihilista/cookie-consent

🛠️ Usage

1. Import Styles (Optional)

The package provides default styles that you can import, or you can skip this and use your own custom CSS:

// Option A: Use default styles
import '@mihilista/cookie-consent/styles';

// Option B: Skip the import above and use your own custom CSS
// The components use CSS classes with the 'cc--' prefix

2. Wrap Your App with the CookieConsentProvider

In your Next.js layout.tsx file:

import '@mihilista/cookie-consent/styles'; // Optional
import { CookieConsentProvider } from "@mihilista/cookie-consent";

export default function RootLayout({
  children,
}: Readonly<{ children: React.ReactNode }>) {
  return <CookieConsentProvider>{children}</CookieConsentProvider>;
}

3. Add Cookie Components

Add the CookieBanner, CookiePreferencesModal, and CookiePreferencesLink

In a shared component or directly in your pages (or layout):

import { CookieBanner, CookiePreferencesModal, CookiePreferencesLink } from "@mihilista/cookie-consent";

export default function CookieConsent() {
  return (
    <>
      <CookieBanner />
      <CookiePreferencesModal />
      <CookiePreferencesLink/>
    </>
  );
}

4. Customize Preferences (Optional)

The package comes with three default categories (functional, analytics, and marketing), but you can customize them in future updates.


🎨 Styling

The package offers flexible styling options:

Option 1: Default Styles

Import the pre-built styles for a quick start:

import '@mihilista/cookie-consent/styles';

Option 2: Custom Styles

Skip the default styles import and create your own CSS. All components use the cc-- prefix for their CSS classes:

  • Banner: .cc--banner, .cc--banner__content, .cc--banner__buttons
  • Modal: .cc--modal, .cc--modal__overlay, .cc--modal__content
  • Buttons: .cc--button, .cc--button--primary, .cc--button--secondary

Reference the source files for the complete class list:

  • src/styles/banner.css
  • src/styles/modal.css
  • src/styles/global.css

Option 3: Hybrid Approach

Import default styles and override specific properties:

import '@mihilista/cookie-consent/styles';
import './my-cookie-overrides.css';
/* my-cookie-overrides.css */
.cc--banner {
  background: #your-brand-color;
}

.cc--button--primary {
  background: #your-accent-color;
}

🎨 Example

Here’s how it looks out of the box:

  • Banner: A simple, responsive banner at the bottom of the screen.
  • Preferences Modal: A fully accessible modal for managing cookie preferences.
  • Preferences Modal Button: A button to show preferences modal after accepting/rejecting the cookies.

🛡️ GDPR Compliance

This package includes features like:

  • Consent storage via cookies.
  • Options to accept, reject, or customize preferences.
  • Support for required cookies (e.g., functional cookies).

Make sure to consult a legal expert to ensure full compliance with local regulations.


🚧 Roadmap

  • Add support for custom categories.
  • Introduce themes and positioning.
  • Add multi-language support.

🌟 Credits

This package was crafted with care, a touch of passion, and a sprinkle of AI magic. It’s the result of a collaborative effort between Mihi and Astra, an AI assistant who’s always ready to lend a helping hand. ❤️


📊 Show Some Love!

If you find this package helpful, I’d love to hear about it! Share your feedback, feature requests, or even your project milestones with me. And hey, if you feel like dropping a ⭐ on GitHub, I won’t complain! 😉


🔗 Links