Installation
Add the module to your Nuxt app.
Installation
Install the module and its peer dependency, @nuxt/scripts ^1.0.0:
bun add @websideproject/nuxt-cookie-consent @nuxt/scripts
pnpm add @websideproject/nuxt-cookie-consent @nuxt/scripts
npm install @websideproject/nuxt-cookie-consent @nuxt/scripts
Add it to your modules:
nuxt.config.ts
export default defineNuxtConfig({
modules: ['@websideproject/nuxt-cookie-consent'],
})
The module registers @nuxt/scripts itself, so useScript and the consent triggers work without adding it to modules. Requires Nuxt 4.
Add the components
Place the components in your layout or app.vue:
app.vue
<template>
<div>
<NuxtPage />
<CookieConsentBanner />
<CookieConsentModal />
<CookieConsentFab />
</div>
</template>
The built-in components are plain CSS, themed from the
colors option: no UI framework, Tailwind or icon library needed. To render them with your own UI kit, override them with same-named components.Next: Configuration.
Introduction
What nuxt-cookie-consent is and the problems it solves.
Configuration
Categories, cookies, colors, links, and the intelligent banner.