From 11a63b5dec29eff3f381dd4d101964449c62dc91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Fri, 17 Apr 2026 09:35:40 +0400 Subject: [PATCH] Add readme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- packages/cookie-banner/README.md | 225 +++++++++++++++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 packages/cookie-banner/README.md diff --git a/packages/cookie-banner/README.md b/packages/cookie-banner/README.md new file mode 100644 index 000000000..819c2209b --- /dev/null +++ b/packages/cookie-banner/README.md @@ -0,0 +1,225 @@ +# @probo/cookie-banner + +A lightweight, GDPR-compliant cookie consent banner for the web. Works with any framework or plain HTML — zero dependencies, powered by Web Components. + +## Installation + +```bash +npm install @probo/cookie-banner +``` + +## Quick Start (Script Tag) + +The fastest way to add a cookie banner to any website. Drop a single ` +``` + +This automatically renders a fully styled consent dialog and a floating settings button so visitors can change their preferences at any time. + +| Attribute | Required | Description | +| ---------------- | -------- | ----------------------------------------------------------------- | +| `data-banner-id` | Yes | Your banner ID from the Probo dashboard | +| `data-base-url` | Yes | The Probo cookie-banner API base URL | +| `data-position` | No | Settings button position: `bottom-left` (default), `bottom-right` | + +## Themed Banner (ES Module) + +Import the pre-built themed banner as an ES module for use in bundled applications (React, Vue, Svelte, etc.): + +```js +import { registerThemedBanner } from "@probo/cookie-banner/themed-banner"; + +registerThemedBanner(); +``` + +Then use the `` custom element anywhere in your HTML or templates: + +```html + +``` + +### Theming with CSS Custom Properties + +The themed banner renders inside a Shadow DOM and exposes CSS custom properties for styling: + +```css +probo-cookie-banner { + --probo-font-family: "Inter", sans-serif; + --probo-bg: #ffffff; + --probo-text: #1a1a1a; + --probo-text-secondary: #555555; + --probo-border: #e0e0e0; + --probo-radius: 12px; + --probo-shadow: 0 4px 24px rgba(0, 0, 0, 0.12); + --probo-accent: #1a1a1a; + --probo-accent-text: #ffffff; + --probo-overlay: rgba(0, 0, 0, 0.4); + --probo-z-index: 2147483646; +} +``` + +Dark mode example: + +```css +@media (prefers-color-scheme: dark) { + probo-cookie-banner { + --probo-bg: #1a1a1a; + --probo-text: #f0f0f0; + --probo-text-secondary: #a0a0a0; + --probo-border: #333333; + --probo-accent: #f0f0f0; + --probo-accent-text: #1a1a1a; + --probo-overlay: rgba(0, 0, 0, 0.6); + } +} +``` + +## Headless Components (Full Control) + +For complete control over the UI, import the headless Web Components directly. This entrypoint gives you unstyled building blocks that you compose and style yourself: + +```js +import { registerComponents } from "@probo/cookie-banner"; + +registerComponents(); +``` + +Then build your own banner layout using the provided custom elements: + +```html + + + +
+

We use cookies to improve your experience.

+ + + + + + + + + +
+
+ + + +
+ + + + + + +
+
+ + + +
+``` + +### Available Components + +| Component | Description | +| ---------------------------- | ------------------------------------------------------------------------------------------------------------ | +| `` | Root element. Requires `banner-id` and `base-url` attributes. Manages client lifecycle and state. | +| `` | Container shown when consent has not been given yet. | +| `` | Wraps a button that records "accept all" consent. | +| `` | Wraps a button that records "reject all" consent. | +| `` | Wraps a button that opens the preference panel. | +| `` | Container for per-category consent toggles. | +| `` | Renders a `