Zero dependencies
Ships as plain .astro/.js source, compiled by your own project’s Astro pipeline. No
runtime dependencies.
GDPR & ePrivacy‑minded by design
Free forever — MIT licensed, unlimited sites
A tiny, dependency-free cookie consent banner for Astro. No dark patterns, no pre-ticked boxes, no permanent silent consent — the mechanics regulators actually check for, built in by default.
npm install astro-cookie-consentLive — not a screenshot
A cookie banner people can’t actually use isn’t compliant. These are the mechanics that regulators (CNIL, ICO, EDPB) actually check for — built in by default, not bolted on:
getConsentRecord() — something to show if you ever need to demonstrate consent was given
(Art. 7(1) accountability).This library is a mechanism, not legal advice — your privacy policy, the categories you declare, and what you gate behind them are still on you. See exactly what this does and doesn’t cover →
Zero dependencies
Ships as plain .astro/.js source, compiled by your own project’s Astro pipeline. No
runtime dependencies.
Actually gates scripts
gateScript() blocks third-party scripts until the visitor accepts — not just an
informational banner that lets trackers load anyway.
Per-category consent
Optional analytics/marketing-style category toggles, or a single accept/decline if you don’t need that.
Fully customizable
Every visual is 7 CSS custom properties, and every string of copy is a prop — no hardcoded text to fork, no design system to fight.
Light & dark mode
Follows the visitor’s OS color scheme automatically, or pin a theme with a data-theme
attribute.
Works with AI coding agents
Ships a SKILL.md documenting its own API and guardrails, so an agent can safely customize it
— change copy, gate a new script, add a theme — without guessing.
One plan: everything, for everyone, free forever.
Free Forever
$0/forever
Unlimited sites. No credit card, ever.
MIT licensed — open source, forever free.
Fully customizable, right down to the last pixel and word — every visual is 7 CSS custom properties, no build step, no config file.
Explore all themes →---import ConsentBanner from 'astro-cookie-consent/ConsentBanner.astro';---
<html> <body> <slot /> <ConsentBanner privacyHref="/privacy" /> </body></html><script> import { gateScript } from 'astro-cookie-consent';
gateScript({ src: 'https://example-widget.com/embed.js' });</script>That’s it — no config file, no CSS to write, no dependency to audit.
Ready to add it to your site?
Get Started