Skip to main content

Configuration

Basic options

OptionTypeDefaultDescription
enabledbooleantrueDisable the plugin without removing it from the config.
titlestring'Cookie Consent'Heading shown in the modal/toast.
descriptionstring'We use cookies…'Body text. Supports [label](url) markdown links.
linksArray<{label,href}>[]Footer-style links (privacy, cookies, terms).
acceptAllTextstring'Accept All'Primary button label.
rejectOptionalTextstring'Reject Optional'Keep-necessary-only button label.
rejectAllTextstring'Reject All'Reject everything button label.
storageKeystring'cookie-consent-preferences'localStorage key.
toastModebooleanfalsetrue = bottom toast, false = centered modal.

Complete example

{
title: 'We Value Your Privacy',
description:
'We use cookies to improve your experience, analyze site traffic, and personalize content. By clicking "Accept All", you consent to our use of cookies. You can also [manage your preferences](/cookie-preferences) or read our [Privacy Policy](/privacy).',
links: [
{ label: 'Privacy Policy', href: '/privacy' },
{ label: 'Cookie Policy', href: '/cookies' },
{ label: 'Terms of Service', href: '/terms' },
],
acceptAllText: 'Accept All Cookies',
rejectOptionalText: 'Essential Only',
rejectAllText: 'Reject All',
toastMode: true,
storageKey: 'my-site-cookie-consent',
}

For category-level controls, see Categories. For GTM/GA4 integration, see Google Consent Mode.

TypeScript types

import type {
CookieConsentOptions,
CookieCategory,
CookieConsentLink,
CookiePreferences,
ConsentState,
GoogleConsentModeConfig,
} from 'docusaurus-plugin-cookie-consent';