---
title: ConsentManagerProvider
description: The root provider component that initializes the consent system and makes consent state available to all child components.
---
<import src="../../../shared/react/components/consent-manager-provider.mdx#intro" />

## Basic Usage

```tsx
import { type ReactNode } from 'react';
import { ConsentManagerProvider, ConsentBanner, ConsentDialog } from '@c15t/nextjs';

export default function ConsentManager({ children }: { children: ReactNode }) {
  return (
    <ConsentManagerProvider
      options={{
        mode: 'hosted',
        backendURL: '/api/c15t',
        consentCategories: ['necessary', 'measurement', 'marketing'],
      }}
    >
      <ConsentBanner />
      <ConsentDialog />
      {children}
    </ConsentManagerProvider>
  );
}
```

<import src="../../../shared/react/components/consent-manager-provider.mdx#options-reference" />

## Mode: hosted vs offline

```tsx
// Hosted mode — persists to hosted backend
<ConsentManagerProvider
  options={{
    mode: 'hosted',
    backendURL: '/api/c15t',
  }}
>

// Offline mode — local cookie storage only
<ConsentManagerProvider
  options={{
    mode: 'offline',
  }}
>
```

See [Client Modes](/docs/frameworks/next/concepts/client-modes) for a detailed comparison.

<import src="../../../shared/react/components/consent-manager-provider.mdx#legal-links" />

<import src="../../../shared/react/components/consent-manager-provider.mdx#overrides" />

<import src="../../../shared/react/components/consent-manager-provider.mdx#policy-packs" />

<import src="../../../shared/react/components/consent-manager-provider.mdx#props" />
