# Redline

Proposed edits in proofreader's red ink, each with a sign-here flag to accept or reject it. Nothing is applied until someone decides.

- Category: Documents
- Docs: https://bevel-ui.vercel.app/components/redline
- Import from: `@/components/ui/redline`

## Install

```bash
npx shadcn@latest add @bevel/redline
```

npm dependencies (installed by the CLI): `cn`.

## Anatomy

```tsx
<Redline onDecisionsChange={save}>
  <RedlineDocument>
    … <RedlineChange id="period" deletion="thirty" insertion="sixty" /> …
  </RedlineDocument>
  <RedlineToolbar />
</Redline>
```

## Parts

| Part | Renders | Description |
| --- | --- | --- |
| `Redline` | div | Holds the decisions: decisions, defaultDecisions, onDecisionsChange ({ id: accepted \| rejected }). |
| `RedlineDocument` | div | The text being edited. |
| `RedlineChange` | span (group) | One edit: id, deletion, insertion. Uses real del and ins, read as “deleted” and “inserted”. Its flag holds Accept and Reject. |
| `RedlineToolbar` | div (toolbar) | How many changes are left, with Accept all and Reject all. |

## Example: A notice clause

Three suggested edits. Decide each one, or all at once.

```tsx
"use client"

import { Redline, RedlineChange, RedlineDocument, RedlineToolbar } from "@/components/ui/redline"

/** The drafting agent's suggested edits to a notice clause. Nothing changes until you decide. */
export function RedlineClause() {
  return (
    <Redline>
      <RedlineDocument>
        <strong>9.2 Notice.</strong> Either party may end this lease on{" "}
        <RedlineChange id="period" deletion="thirty (30)" insertion="sixty (60)" /> days&apos; written notice
        delivered <RedlineChange id="delivery" deletion="by hand" insertion="by hand or by registered post" /> to
        the address in Schedule B
        <RedlineChange id="email" insertion=". Notice by email alone is not valid" />.
      </RedlineDocument>
      <RedlineToolbar />
    </Redline>
  )
}
```
