Getting Started
VS Cookies ships as a small runtime plus one skin per banner, distributed as zip archives you add to your project by hand — not through a package registry. Each integration is two zips.
Install
Section titled “Install”Download the zips from the VS GOODS store,
unzip them into a vendor/ folder, and wire up the specifiers in your bundler
(or an import map for plain HTML). See
Installing from the zip for the full walkthrough.
- React app →
@vscookies/react+@vscookies/skin-<slug>-react. - Plain HTML / any stack →
@vscookies/vanilla+@vscookies/skin-<slug>-vanilla. - Fully custom UI →
@vscookies/core(add@vscookies/tokensfor the CSS variables).
Three integration paths
Section titled “Three integration paths”1. React with a ready-made skin
Section titled “1. React with a ready-made skin”import { CookieConsentProvider } from "@vscookies/react";import { MinimalistBanner } from "@vscookies/skin-minimalist-react";
export default function App() { return ( <CookieConsentProvider> <MinimalistBanner mode="light" /> </CookieConsentProvider> );}Importing a skin self-registers it and injects only that skin’s CSS — no extra
stylesheet import is required. You can mount several skins; they share one
consent store. See the React guide for the full props reference and
adding your own tags & cookies via the
provider’s config prop.
2. React headless (your own UI)
Section titled “2. React headless (your own UI)”import { CookieConsentProvider, useCookieConsent } from "@vscookies/react";Use useCookieConsent to read state and trigger
decisions, then render whatever markup you like. See
Build your own UI.
3. Web Components (no React app)
Section titled “3. Web Components (no React app)”<script type="importmap"> { "imports": { "@vscookies/vanilla": "./vendor/vscookies/vanilla/dist/index.js", "@vscookies/vanilla/define": "./vendor/vscookies/vanilla/dist/define.js", "@vscookies/vanilla/internal/react": "./vendor/vscookies/vanilla/dist/internal/react.js", "@vscookies/vanilla/internal/headless": "./vendor/vscookies/vanilla/dist/internal/headless.js", "@vscookies/skin-minimalist-vanilla": "./vendor/vscookies/skin-minimalist-vanilla/dist/index.js" } }</script><script type="module"> import { defineAll } from "@vscookies/vanilla/define"; import "@vscookies/skin-minimalist-vanilla"; defineAll();</script>
<vscookies-minimalist></vscookies-minimalist>See the Vanilla guide for attributes and the custom-element
properties. To attach your own tags/cookies, pass a config once:
defineAll({ categories: { ...DEFAULT_CATEGORY_RULES, … } }) — see
adding your own tags & cookies.
Styling and tokens
Section titled “Styling and tokens”Both runtimes bundle @vscookies/tokens and load its global state variables for
you. UI values are owned by each skin. The same contract is exported from each
runtime: GLOBAL_TOKEN_MANIFEST, GLOBAL_TOKEN_NAMES,
setTokenOverrides(values, { skin? }), clearTokenOverrides({ skin? }) and
clearAllTokenOverrides(). Use these to build your own live token editor — see
Tokens. All visual values are CSS variables (--vsc-state-* plus
each skin’s prefix).
Framework notes
Section titled “Framework notes”| Environment | Notes |
|---|---|
| Client-rendered React | Drop the provider at the app root; skins mount inside it. |
| SSR / RSC | The core is browser-safe (it no-ops without document). Render banners behind a client boundary/mount. |
| Plain HTML | Use @vscookies/vanilla with an import map and a skin zip. |