Socket
Book a DemoInstallSign in
Socket

@consentry/ui

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@consentry/ui

Composable UI components for the Consentry consent manager. Built with Emotion and designed for use with @consentry/core or @consentry/next.

Source
npmnpm
Version
0.1.5
Version published
Weekly downloads
9
350%
Maintainers
1
Weekly downloads
 
Created
Source

@consentry/ui

Headless and fully customizable React components for the Consentry consent manager. Includes modals, banners, toggles, and more — built for flexibility and themeability.

✨ Overview

@consentry/ui is the official component library for @consentry/core and @consentry/next. It provides:

  • 🎨 Customizable cookie banner and settings modal
  • ⚙️ Headless, themeable, and styled with Emotion + Framer Motion
  • 🧩 Fully controlled or automatic modes
  • 🔄 Animations and accessibility baked-in
  • 🧑‍💻 Easy integration with any config or hook-based logic

📦 Installation

npm install @consentry/ui @consentry/core @consentry/next

⚙️ Usage

1. Wrap your app with ConsentManagerProvider (from @consentry/next)

"use client";
import { ConsentManagerProvider } from "@consentry/next";
import ConsentManager from "@consentry/ui";
import consentConfig from "./consent.config";

export default function RootLayout({ children }) {
  return (
    <ConsentManagerProvider config={consentConfig}>
      <ConsentManager mode="modal" dark={false} />
      {children}
    </ConsentManagerProvider>
  );
}

🧠 Features

🧱 ConsentManager Component

The main UI component. Renders:

  • ✅ A floating settings button (optional)
  • ✅ A cookie banner (auto-displayed if no prior consent)
  • ✅ A settings modal with toggleable cookie categories

Props

PropTypeDefaultDescription
mode"modal" | "top" | "bottom"Defines banner layout
darkbooleanfalseEnables dark mode styling
hideSettingsButtonbooleanfalseHides the floating button
categoriesCookieCategory[]predefinedOverride default cookie categories
labelsobjectpredefinedCustomize banner and modal text
classNamesobjectCustomize class names per section

🪝 Control from Anywhere

To open the settings modal programmatically (e.g., from a Privacy page):

import { openConsentSettings } from "@consentry/ui";

<button onClick={() => openConsentSettings()}>Open Cookie Settings</button>;

🎨 Customization

You can customize:

  • Text (labels.banner, labels.modal)
  • Style (classNames.container, classNames.title, etc.)
  • Behavior (dark, mode, hideSettingsButton)

📄 License

MIT — Copyright © 2025
Mustafa ONAL
github.com/consentryio

Keywords

cookie-consent

FAQs

Package last updated on 15 Apr 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