X Enterprises
nuxt-x-marketing

PrivacyGDPR

Modal for granular cookie category preferences with toggles for required and optional categories.

PrivacyGDPR

A modal providing granular cookie category controls. Required categories are shown with a locked toggle. Users can accept all, reject all, or save a custom selection. The selected preferences are persisted to localStorage under storageKey, and cookie-consent is set to 'customized' whenever the user saves. Links to Privacy Policy and Cookie Policy pages are shown at the bottom.

Components

<XMarkPrivacyGDPR />

<XMarkPrivacyGDPR
  v-model="gdprOpen"
  title="Privacy Preferences"
  description="Choose which cookies you allow us to use."
  :categories="[
    {
      id: 'necessary',
      name: 'Necessary',
      description: 'Required for the site to function.',
      required: true,
    },
    {
      id: 'analytics',
      name: 'Analytics',
      description: 'Help us understand how visitors use the site.',
      required: false,
    },
    {
      id: 'marketing',
      name: 'Marketing',
      description: 'Used for targeted advertising.',
      required: false,
    },
  ]"
  privacy-link="/privacy"
  cookie-link="/cookies"
  storage-key="gdpr-prefs-v1"
  :button="{ label: 'Cookie Settings', icon: 'i-lucide-cookie' }"
  @save="onConsentSaved"
/>

The component renders a default trigger button using the button config. Place it without a trigger slot for self-managed visibility, or wrap it in <ClientOnly> and toggle via v-model.

Props

PropTypeDefaultDescription
modelValuebooleanfalseControls modal visibility (v-model).
titlestring'Privacy Preferences'Modal heading.
descriptionstringDefault descriptionIntroductory text.
categoriesarray4 default categoriesCookie categories [{ id, name, description, required }].
privacyLinkstring'/privacy'Privacy Policy page URL.
cookieLinkstring'/cookies'Cookie Policy page URL.
storageKeystring'gdpr-preferences'localStorage key for storing the saved preference map.
buttonobject{}Trigger button config { label?, color?, variant?, size?, icon? }. Falls back to a "Cookie Settings" neutral outline button.

Emits

EventPayloadDescription
update:modelValuebooleanv-model sync.
saveselections: { [categoryId: string]: boolean }Selected category IDs map when user saves preferences.
acceptUser clicked Accept All.
rejectUser clicked Reject All.

AI Context

category: Privacy
package: "@xenterprises/nuxt-x-marketing"
components:
  - XMarkPrivacyGDPR
use-when: >
  Providing granular cookie category opt-in/opt-out when GDPR compliance
  requires it. Typically triggered by the "Customize" action in
  XMarkPrivacyCookieBanner or a "Cookie Settings" link in the footer.
typical-page-section: Modal overlay — triggered from cookie banner or footer link.
Copyright © 2026