# Consent preferences footer

Review optional services and save category preferences.

Access: pro. Category: Blocks. Kind: section.

## When to use

- Use it when a page needs review optional services and save category preferences.
- Choose it as the footer region when composing a page from independently reusable TidalUI sections.

## Alternatives

- Choose footer instead when a responsive semantic footer with typed navigation groups, native destination links, and optional reference, status, and legal regions is the actual interface need, rather than consent preferences footer.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Consent preferences footer

```sh
npx shadcn@latest add @tidal-pro/footer-consent
```

Stylesheets: `components/ui/tidal.css`, `components/ui/footer-consent.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/footer-consent.css";
import{TidalFooterConsent}from"./components/ui/footer-consent";
export default()=><div className="tidal-scope"><TidalFooterConsent brand={"value"} categories={[{id:"example",label:"Demo"}]} heading={"Demo"} onCategoryChange={() => {}} values={{}}/></div>;
```

## Structured props

- `TidalFooterConsent.brand: ReactNode`: Required brand value accepted by this exported component.
- `TidalFooterConsent.categories: ReadonlyArray<TidalFooterConsentCategory>`: Required categories value accepted by this exported component.
- `TidalFooterConsent.heading: ReactNode`: Required heading value accepted by this exported component.
- `TidalFooterConsent.onCategoryChange: (id: string, checked: boolean) => void`: Callback invoked when the category change interaction is proposed.
- `TidalFooterConsent.values: Readonly<Record<string, boolean>>`: Required values value accepted by this exported component.
- `TidalFooterConsent.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalFooterConsent.error?: ReactNode`: Optional error value accepted by this exported component.
- `TidalFooterConsent.formProps?: SafeFormProps | undefined`: Optional form props value accepted by this exported component.
- `TidalFooterConsent.formRef?: Ref<HTMLFormElement> | undefined`: Optional form ref value accepted by this exported component.
- `TidalFooterConsent.headingLevel?: TidalFooterConsentHeadingLevel | undefined` (default "h2"): Optional heading level value accepted by this exported component.
- `TidalFooterConsent.legal?: ReactNode`: Optional legal value accepted by this exported component.
- `TidalFooterConsent.onRejectOptional?: ((event: MouseEvent<HTMLButtonElement>) => void) | undefined`: Callback invoked when the reject optional interaction is proposed.
- `TidalFooterConsent.onReset?: FormEventHandler<HTMLFormElement> | undefined`: Callback invoked when the reset interaction is proposed.
- `TidalFooterConsent.onSubmit?: FormEventHandler<HTMLFormElement> | undefined`: Callback invoked when the submit interaction is proposed.
- `TidalFooterConsent.policyLabel?: ReactNode` (default "Privacy and policy"): Optional policy label value accepted by this exported component.
- `TidalFooterConsent.policyLinks?: ReadonlyArray<TidalFooterConsentLink> | undefined` (default []): Optional policy links value accepted by this exported component.
- `TidalFooterConsent.rejectButtonProps?: SafeButtonProps | undefined`: Optional reject button props value accepted by this exported component.
- `TidalFooterConsent.rejectButtonRef?: Ref<HTMLButtonElement> | undefined`: Optional reject button ref value accepted by this exported component.
- `TidalFooterConsent.rejectOptionalLabel?: ReactNode` (default "Reject optional"): Optional reject optional label value accepted by this exported component.
- `TidalFooterConsent.saveButtonProps?: SafeButtonProps | undefined`: Optional save button props value accepted by this exported component.
- `TidalFooterConsent.saveButtonRef?: Ref<HTMLButtonElement> | undefined`: Optional save button ref value accepted by this exported component.
- `TidalFooterConsent.saveLabel?: ReactNode` (default "Save preferences"): Optional save label value accepted by this exported component.
- `TidalFooterConsent.saveState?: TidalFooterConsentState | undefined` (default "idle"): Optional save state value accepted by this exported component.
- `TidalFooterConsent.status?: ReactNode`: Optional status value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/footer-consent.tsx) | [Manifest](https://tidalui.com/examples/footer-consent.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useState, type MouseEvent } from "react";

import { TidalFooterConsent, type TidalFooterConsentCategory, type TidalFooterConsentLink, type TidalFooterConsentState } from "./components/ui/footer-consent";

import "./components/ui/footer-consent.css";

import "./components/ui/toggle-switch.css";



const tidalExampleStyles = ".tidal-scope .footer-pilot-07-demo {\n  inline-size: 100%;\n  min-inline-size: 0;\n}";

const categories: readonly TidalFooterConsentCategory[] = [
  {
    id: "essential",
    label: "Essential services",
    description: "Needed to keep the site working.",
    required: true,
  },
  {
    id: "analytics",
    label: "Analytics",
    description: "Help us understand which pages are useful.",
  },
];

const policyLinks: readonly TidalFooterConsentLink[] = [
  { id: "privacy", label: "Privacy policy", href: "#consent-privacy" },
  { id: "cookies", label: "Cookie details", href: "#consent-cookies" },
];

function handlePreviewClick(
  label: string,
  setStatus: (status: string) => void,
) {
  return (event: MouseEvent<HTMLAnchorElement>) => {
    if (
      event.defaultPrevented ||
      event.button !== 0 ||
      (event.detail !== 0 && event.detail !== 1) ||
      event.metaKey ||
      event.ctrlKey ||
      event.shiftKey ||
      event.altKey ||
      event.currentTarget.target
    ) {
      return;
    }
    event.preventDefault();
    setStatus(`${label} selected in this local preview.`);
  };
}

export function FooterConsentDemo() {
  const [values, setValues] = useState<Readonly<Record<string, boolean>>>({
    essential: true,
    analytics: false,
  });
  const [saveState, setSaveState] = useState<TidalFooterConsentState>("idle");
  const [status, setStatus] = useState(
    "No preference result has been submitted.",
  );
  const localPolicyLinks = policyLinks.map((link) => ({
    ...link,
    onClick: handlePreviewClick(String(link.label), setStatus),
  }));

  return (
    <div className="footer-pilot-07-demo">
      <TidalFooterConsent
        aria-label="Consent preferences footer example"
        brand={<span>TidalUI workspace</span>}
        heading="Privacy preferences."
        description="Choose which optional services you allow."
        categories={categories}
        values={values}
        onCategoryChange={(id, checked) => {
          setValues((current) => ({ ...current, [id]: checked }));
          setSaveState("dirty");
          setStatus(
            `${id} is now ${checked ? "enabled" : "disabled"} locally.`,
          );
        }}
        policyLinks={localPolicyLinks}
        onSubmit={(event) => {
          event.preventDefault();
          setSaveState("saved");
          setStatus(
            "Local preview only. The consumer callback received the supplied values; no cookies or storage were changed.",
          );
        }}
        onRejectOptional={() => {
          setValues((current) => ({ ...current, analytics: false }));
          setSaveState("saved");
          setStatus(
            "Optional choices were proposed as disabled in this local preview; the consumer owns persistence.",
          );
        }}
        saveState={saveState}
        status={status}
        legal={<span>Local preview. No cookies or storage are changed.</span>}
      />
    </div>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <FooterConsentDemo />
    </div>
  );
}

```

## Gotchas

- Install the declared registry dependencies and render inside a tidal-scope with the foundation stylesheet loaded.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Required brand, heading, categories, controlled values and onCategoryChange callback. Categories require unique nonblank IDs and forward safe native switch attributes and refs; required categories are rendered locked. The component owns the native form shell and accepts consumer onSubmit/onReset callbacks while removing replacement children and dangerous markup from root, form, switch and button props. Optional policy links require unique IDs and suppress href plus click and auxiliary activation when disabled. saveState and status remain consumer supplied; the component never reads or writes cookies, storage, consent records or network services. The neutral responsive layout keeps 44px controls, 16px phone switch and link text, linked descriptions, long-text wrapping, RTL-safe layout and reduced motion.
