Skip to content

Introduction

A minimal, headless-first cookie consent library built as a small runtime plus one skin per banner. The runtime owns consent, the skin registry and the token contract; a skin is a single banner shipped as its own zip.

  • Headless core — one small ConsentStore, bundled into both runtimes.
  • Design tokens — every skin reads CSS variables (--vsc-*); both runtimes expose the token contract for live overrides.
  • React runtime + skins — @vscookies/react plus @vscookies/skin-<slug>-react.
  • Vanilla runtime + skins — @vscookies/vanilla plus @vscookies/skin-<slug>-vanilla, as Web Components for any stack.

Tailwind is configured across the docs site and every skin source. Semantic utilities such as bg-surface map directly to —vsc-* tokens.

Distributed as zip archives from the VS GOODS store — see Installing from the zip to add them to your project.

PackageWhat it isUse it when
@vscookies/reactReact runtime: headless consent, skin registry, token contract (bundles core + tokens)You are building in React
@vscookies/skin-<slug>-reactOne React banner skin (minimalist, edito)You want a ready-made React banner
@vscookies/vanillaWeb Component runtime: skin registry, bundled React + core + tokens + headless providerYou are not using React
@vscookies/skin-<slug>-vanillaOne banner skin as a custom elementYou want a ready-made banner on any stack
@vscookies/coreHeadless store + cookie helpersYou want full control or a custom UI
@vscookies/tokensDesign tokens (CSS vars + TS)You want to style things yourself

The runtimes already bundle @vscookies/core and @vscookies/tokens; download those zips separately only when building a fully custom UI.

App.tsx
import { CookieConsentProvider } from "@vscookies/react";
import { MinimalistBanner } from "@vscookies/skin-minimalist-react";
export default function App() {
return (
<CookieConsentProvider>
<MinimalistBanner mode="light" />
</CookieConsentProvider>
);
}

The skin self-registers on import. You can mount several skins — they all share one consent store via useSyncExternalStore.

import { CookieConsentProvider, useCookieConsent } from "@vscookies/react";
function MyBanner() {
const { hasConsented, acceptAll, rejectAll } = useCookieConsent();
if (hasConsented) return null;
return (
<div>
<button onClick={acceptAll}>Accept</button>
<button onClick={rejectAll}>Reject</button>
</div>
);
}
<script type="module">
import { defineAll } from "@vscookies/vanilla/define";
import "@vscookies/skin-minimalist-vanilla";
defineAll();
</script>
<vscookies-minimalist></vscookies-minimalist>

In plain HTML, add an import map mapping the runtime, its define and internal subpaths, and each skin to their unzipped dist/index.js files — see Installing from the zip.