# React components

The signing screen, the sender's flow, a document's status and an editor, running inside your product with a session secret.


## Install {#install}

```bash
npm install @monoclan/react
```

```tsx
import '@monoclan/react/styles.css';
import { SigningForm } from '@monoclan/react';
```

The packages are private; your account manager gives your team access. Styles are scoped under `.sfs-root` and never touch the rest of your page.

## SigningForm {#signing-form}

The signer's screen: their details, the document with their places numbered, the signature, done.

```tsx
<SigningForm
  clientSecret={secret}          // a signing session
  locale="ru"                    // or let the signer's language decide
  appearance={{ variables: { colorPrimary: '#5b3ea8' } }}
  onComplete={(view) => …}
  onDecline={(view) => …}
  onContextChange={(ctx) => …}   // what the signer sees, for an agent beside them
/>
```

On phones the document reads at screen width and the signature opens in a sheet; on wide screens the label stands beside the page.

## DocumentStatus {#status}

Where a document stands, who has done what, remind and withdraw (with the session's features), the signed PDF, and the history.

```tsx
<DocumentStatus clientSecret={viewingSecret} onChange={(view) => …} onBeforeVoid={async () => confirm('Withdraw?')} />
```

## DocumentCard {#card}

One document in a list. It needs no session: pass the document your backend fetched.

```tsx
{docs.map((d) => <DocumentCard key={d.id} document={d} onOpen={open} />)}
```

## SendFlow {#send-flow}

The sender's side: who signs, the sender's fields numbered on the page, the message, an optional text editor, and one button that leads to the next missing thing and finally sends.

```tsx
<SendFlow clientSecret={editingSecret} onBeforeSend={async (view) => true} onSent={(view) => …} />
```

`onBeforeSend` gives your product the last word: return `false` to stop.

## ApprovalCard {#approval}

An agent prepared a draft; the card says what it did, who it goes to and what still blocks it, and sends only on a person's click.

```tsx
<ApprovalCard clientSecret={editingSecret} agentName="Claude" summary="Filled in the date and fee." onReview={openSendFlow} />
```

## DocumentEditor {#editor}

The draft's text, editable in place. Small edits keep the Word formatting exactly; moving a field rewrites the paragraph and keeps its style and numbering.

## Agent context {#agent-context}

Every component reports what the person sees through `onContextChange`: the document, the step, the field they are in, the blocks in view and the text they selected, by block id, under 8 KB, never signatures or other signers' values. Give it to your agent so "make this clause shorter" means the clause on screen.
