0.1.9 • Published 9 months ago

@consentry/ui v0.1.9

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@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

0.1.9

9 months ago

0.1.8

9 months ago

0.1.7

10 months ago

0.1.6

10 months ago

0.1.5

10 months ago

0.1.4

10 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago