# Legal Page

> Terms, privacy, cookie and data processing pages in one template: a document switcher, a plain-English summary and numbered sections.

- Type: React template (Templates)
- Access: Pro (the source needs a Wingo UI Pro plan, see https://wingo-ui.com/pricing)
- Version: 1.1.0
- Install: `npx wingo-ui@latest add legal-page`
- Docs: https://wingo-ui.com/templates/legal-page

## Interaction

Switch between Terms, Privacy, Cookies and DPA in the pill row at the top (links to /legal/terms, /legal/privacy...; the thumb slides to the current one). Each document opens with its dates, a Download PDF and a Print action (both open the print dialog unless onDownload / onPrint are set; header, footer and navigation are hidden in print), and a short plain-English summary. On desktop the sticky On this page list follows your reading position and jumps to a section on click; arrow keys, Home and End move between its links. On phones it becomes a pill pinned under the header that shows the current section and opens a bottom sheet with every section. Every section heading has a copy button that copies its link (/legal/privacy#your-rights) and confirms with a check. Links inside the text to another document switch to it. Tables (sub-processors, retention, cookies) turn into one card per row below 768px. The page ends with a contact card: email legal@acme.com, copy the address, or read the postal address. The hero rises in once on mount; reduced motion keeps it still.

## Installation

```bash
npx wingo-ui@latest add legal-page
```

Pro item: run `npx wingo-ui@latest login` once with a Pro account. The CLI adds the files, their dependencies and a version record for updates.

With shadcn: `npx shadcn@latest add @wingo-ui/legal-page` (needs the @wingo-ui registry with your API key in components.json)

Files:

- `components/templates/legal-page.tsx`
- `components/templates/legal-page-data.ts`

npm dependencies: `npm i motion lucide-react`

Wingo UI dependencies (installed automatically):

- [Marketing Header](https://wingo-ui.com/components/marketing-header) ([Markdown](https://wingo-ui.com/components/marketing-header.md))
- [Marketing Footer](https://wingo-ui.com/components/marketing-footer) ([Markdown](https://wingo-ui.com/components/marketing-footer.md))
- [Marketing Section](https://wingo-ui.com/components/marketing-section) ([Markdown](https://wingo-ui.com/components/marketing-section.md))
- [Button](https://wingo-ui.com/components/button) ([Markdown](https://wingo-ui.com/components/button.md))
- [Copy Button](https://wingo-ui.com/components/copy-button) ([Markdown](https://wingo-ui.com/components/copy-button.md))
- [Table Of Contents](https://wingo-ui.com/components/table-of-contents) ([Markdown](https://wingo-ui.com/components/table-of-contents.md))
- [useControllableState](https://wingo-ui.com/components/use-controllable-state) ([Markdown](https://wingo-ui.com/components/use-controllable-state.md))
- [Motion presets](https://wingo-ui.com/components/motion) ([Markdown](https://wingo-ui.com/components/motion.md))
- [Navigation](https://wingo-ui.com/components/navigation) ([Markdown](https://wingo-ui.com/components/navigation.md))
- [Tones](https://wingo-ui.com/components/tones) ([Markdown](https://wingo-ui.com/components/tones.md))
- [UIProvider](https://wingo-ui.com/components/ui-config) ([Markdown](https://wingo-ui.com/components/ui-config.md))

## Usage

```tsx
// app/(marketing)/legal/[doc]/page.tsx
import Link from "next/link"
import { notFound } from "next/navigation"
import { LegalPage } from "@/components/templates/legal-page"
import { LEGAL_DOCUMENTS } from "@/components/templates/legal-page-data"

export function generateStaticParams() {
  return LEGAL_DOCUMENTS.map((doc) => ({ doc: doc.id }))
}

export default async function LegalRoute({ params }: { params: Promise<{ doc: string }> }) {
  const { doc } = await params
  if (!LEGAL_DOCUMENTS.some((item) => item.id === doc)) notFound()
  return <LegalPage linkComponent={Link} doc={doc} contactEmail="legal@acme.com" />
}
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `documents?` | `LegalDocument[]` | `"LEGAL_DOCUMENTS"` | The documents: { id, label, title, description, href, updated, effective, summary, sections }. A section's body is an array of simple blocks (paragraph, heading, list, definitions, table, note) or your own React content. |
| `doc?` | `string` |  | The id of the document shown, controlled; pair it with onDocChange or set it per route. |
| `defaultDoc?` | `string` | `"terms"` | The document shown first while uncontrolled. |
| `onDocChange?` | `(doc: string) => void` |  | Called when the switcher or a link in the text picks another document. |
| `contact?` | `LegalContact` | `"LEGAL_CONTACT"` | { email, company, address } for the contact card at the end. |
| `contactEmail?` | `string` | `""` | Replaces contact.email. |
| `design?` | `"classic" \| "editorial" \| "minimal"` | `"classic"` | The whole page's look. classic: a pill switcher, raised summary, definition and table cards and a soft contact card; editorial: a centered header, a large start-aligned title over a heavy rule, underline tabs, the summary and sections divided by hairlines, open tables, italic notes on a side rule and a centered footer; minimal: a transparent header, a smaller title, a plain switcher, the summary as a quiet side rule, outlined tables, a plain table of contents, extra air and a simple footer. headerProps, footerProps and classNames still win. |
| `background?` | `"plain" \| "soft" \| "glow" \| "aurora" \| "grid" \| "dots"` | `"soft"` | The main background: plain is the bare page color; the others tint the page and add a glow, an aurora, a grid or dots over the first screen. A design picks its own unless you set one. classic uses soft, editorial plain, minimal dots. |
| `backgroundColor?` | `string` | `"oklch(0.62 0.14 275)"` | The tint and glow color of the main background. |
| `numbered?` | `boolean` | `true` | Numbers the section headings and the table of contents. |
| `showSummary?` | `boolean` | `true` | The "The short version" box above the sections. |
| `showToc?` | `boolean` | `true` | The sticky table of contents (a pill and sheet on phones). |
| `showActions?` | `boolean` | `true` | The Download PDF and Print buttons. |
| `showContact?` | `boolean` | `true` | The contact card at the end. |
| `tocVariant?` | `"line" \| "dots" \| "plain"` | `"line"` | The look of the table of contents. Applies to the classic design. |
| `tone?` | `"neutral" \| "brand" \| "success" \| "warning" \| "danger" \| "info"` | `"neutral"` | The table of contents indicator and the summary checks. |
| `header?` | `boolean` | `true` | The sticky marketing header; turn it off inside a site layout. |
| `footer?` | `boolean` | `true` | The marketing footer. |
| `headerProps?` | `Partial<MarketingHeaderProps>` |  | Passed to MarketingHeader (currentPath defaults to the document's href). |
| `footerProps?` | `Partial<MarketingFooterProps>` |  | Passed to MarketingFooter. |
| `onDownload?` | `(doc: LegalDocument) => void` |  | The Download PDF action; without it the print dialog opens (Save as PDF). |
| `onPrint?` | `(doc: LegalDocument) => void` |  | The Print action; default window.print(). |
| `locale?` | `string` | `"en-US"` | Intl locale for the dates. |
| `animateIn?` | `boolean` | `true` | The hero rises in once on mount; off in thumbnails. |
| `linkComponent?` | `(props: LinkComponentProps) => ReactNode` | `"<a>"` | The router link for every link (next/link in an app). |
| `labels?` | `Partial<LegalPageLabels>` |  | Every visible string; English defaults in DEFAULT_LEGAL_PAGE_LABELS. |
| `className?` | `string` |  | Classes for the root. |
| `classNames?` | `Partial<Record<LegalPageSlot, string>>` |  | Classes for hero, switcher, meta, actions, toc, article, summary, section, sectionTitle and contact. |

## Parts

### LegalBlocks (component)

Renders a section's simple blocks: paragraphs, subheadings, lists, definitions, tables (cards on phones) and notes. Takes div props.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `blocks?` | `LegalBlock[]` |  | The blocks to render. |
| `linkComponent?` | `(props: LinkComponentProps) => ReactNode` |  | The router link for links in the text. |
| `onLink?` | `(event, href: string) => void` |  | Called when a link in the text is clicked. |

### LegalText (component)

Inline text with **bold**, [label](href) links and bare email addresses turned into mailto links.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `text?` | `string` |  | The text to render. |
| `linkComponent?` | `(props: LinkComponentProps) => ReactNode` |  | The router link for links. |
| `onLink?` | `(event, href: string) => void` |  | Called when a link is clicked. |

### LEGAL_DOCUMENTS (constant)

The sample Terms of Service, Privacy Policy, Cookie Policy and Data Processing Addendum for Acme.

### LEGAL_CONTACT (constant)

The sample contact: legal@acme.com and a New York postal address.

### LEGAL_PAGE_SAMPLE (constant)

{ documents, contact } in one object.

### DEFAULT_LEGAL_PAGE_LABELS (constant)

The English strings.

### LEGAL_PAGE_DESIGNS (constant)

The design names, classic first: ["classic", "editorial", "minimal"].

### LegalPageDesign (type)

"classic" | "editorial" | "minimal".

### LegalDocument (type)

A document: id, label, title, description, href, updated, effective, summary and sections.

### LegalSection (type)

{ id, title, body }: the id is the anchor, body is LegalBlock[] or a ReactNode.

### LegalBlock (type)

paragraph | heading | list | definitions | table | note.

### LegalContact (type)

{ email, company, address }.

### LegalPageProps (type)

Props of LegalPage: the documents, design, contact details and div attributes.

## Examples

- **Editorial design**: design="editorial": a centered header, large start-aligned type over a heavy rule, underline tabs, hairlines between sections and open tables.
- **Minimal design**: design="minimal": a transparent header, a smaller title, the summary as a quiet side rule, outlined tables, no cards and a simple footer.
- **Privacy policy**: Opens on the privacy policy: purposes, the sub-processors table (cards on phones), GDPR and CCPA rights, retention and cookies.
- **Cookie policy, brand accents**: The cookie policy with dotted contents and brand-orange checks and indicator.
- **Inside a site layout**: No header or footer and no summary: the document alone under your own site chrome.
- **Single column, British dates**: Without the table of contents or numbers: one 720px reading column, dates in en-GB.

## See also

- [Table Of Contents](https://wingo-ui.com/components/table-of-contents) ([Markdown](https://wingo-ui.com/components/table-of-contents.md))
- [Copy Button](https://wingo-ui.com/components/copy-button) ([Markdown](https://wingo-ui.com/components/copy-button.md))
- [Marketing Header](https://wingo-ui.com/components/marketing-header) ([Markdown](https://wingo-ui.com/components/marketing-header.md))
- [Marketing Footer](https://wingo-ui.com/components/marketing-footer) ([Markdown](https://wingo-ui.com/components/marketing-footer.md))
- [Marketing Section](https://wingo-ui.com/components/marketing-section) ([Markdown](https://wingo-ui.com/components/marketing-section.md))

---

Canonical: https://wingo-ui.com/templates/legal-page
More components: https://wingo-ui.com/components · Index for agents: https://wingo-ui.com/llms.txt
