Components
The signing experience, in pieces
Every part of the page a signer sees, shown in each state. They live in src/components/signing, are open source with the rest of TypeSign, and are what the signer page is built from (the free signer shares the PDF signature block). Signing surfaces are always light: people sign on paper-like pages.
The playground runs the whole signing flow on a mock PDF. Nothing is sent or stored.
Theme
One accent colour drives every brand shade on the signing surface: buttons, tints, focus rings and field outlines. TypeSign blue is the default. Pick a preset or your own colour; the whole page follows. In code: wrap the surface in accentProps("forest") or accentProps("#0f766e"), or set data-signing-accent="custom" and --signing-accent in CSS.
Props: ThemePicker, accentProps
ThemePicker
| Prop | Type | Default | What it does |
|---|---|---|---|
| value | SigningAccent | A preset id or a #rrggbb colour. | |
| onChange | (a: SigningAccent) => void | Called with the new accent. | |
| compact | boolean | false | Smaller swatches for toolbars. |
accentProps
| Prop | Type | Default | What it does |
|---|---|---|---|
| accent | string | null | TypeSign blue | Spread the result on the element that wraps a signing surface. |
Signature block in the PDF
What a signature looks like on paper. The top line says what was checked, never a brand claim: 'Email verified with a one-time code' for envelopes, 'Self-declared: identity not checked' in the free signer, red TEST or MOCK for test output (ADR 0015). The typed signature uses the same font as on screen, embedded in the PDF. Drawn by the same code on the server and in the free signer.
Props: drawSignatureBlock
drawSignatureBlock
| Prop | Type | Default | What it does |
|---|---|---|---|
| signature | typed | drawn | The typed text with its font, or the drawn image. | |
| assurance | string | First line: what was checked. Never a brand claim. | |
| warning | boolean | false | Red bracket and text for test or mock output. |
| title | string | The signer's name under the line. | |
| detail | string | Time and evidence id, or the fingerprint note. |
Document fields
Fields sit on the rendered page. Dashed means it is waiting for you, a solid outline with a tag is the next thing to do, a check means done, grey is filled in for you. Initials are a design preview: the API has no initials field yet (proposal in ADR 0019).
Props: FieldBox, PlacedField
FieldBox
| Prop | Type | Default | What it does |
|---|---|---|---|
| kind | "signature" | "initials" | "text" | "date" | "checkbox" | What the field holds. | |
| state | "todo" | "active" | "done" | "locked" | Waiting, next to do, done, or filled in for you. | |
| box | { x, y, width, height } | Position on the page, each 0 to 1. | |
| label | string | null | The sender's label, used in the tag and for screen readers. | |
| required | boolean | false | Required, as data-required. Say it in the control's label too. |
| quietTag | boolean | false | Outlined tag, when a bottom bar is the primary action. |
| tag | "above" | "side" | "below" | "above" | Where the active tag sits; beside or below when another field is just above. |
| onActivate | () => void | Called when the box itself is clicked or tapped. | |
| id | string | Target id for the navigator and scrollToField. |
PlacedField
| Prop | Type | Default | What it does |
|---|---|---|---|
| box | Box | Position and size on the page, each 0 to 1. | |
| onChange | (b: Box) => void | Called while it is dragged, resized or moved with keys. | |
| onRemove | () => void | The × button and Delete. | |
| label | string | What the field is, for screen readers. | |
| selected | boolean | false | Show the handles without focus, e.g. right after placing. |
| onSelect | () => void | Called when the field gets focus. | |
| minWidth | number | 0.06 | Smallest width, as a share of the page. |
| minHeight | number | 0.02 | Smallest height, as a share of the page. |
| id | string | Set as data-field-id, to focus a field just placed. |
Signature capture
Type or draw. The typed name is shown in a script face on a signing line, so it looks like what lands in the document.
Your signature
Style
Props: SignatureCapture, SignaturePreview, SignatureLine, SignatureFontPicker, SignaturePad
SignatureCapture
| Prop | Type | Default | What it does |
|---|---|---|---|
| defaultName | string | Prefills the typed name. | |
| defaultValue | CapturedSignature | null | Read on mount: the last value onChange reported, so a remount keeps what the person chose. Change key to reset. | |
| onChange | (s: CapturedSignature | null) => void | Typed text with font, or a drawn PNG. | |
| title | string | "Your signature" | Heading. Empty when a container (a sheet) has its own. |
| padHeight | number | 180 | Height of the drawing pad in CSS pixels. |
| headingLevel | 2 | 3 | 2 | Heading level in the page outline. |
SignaturePreview
| Prop | Type | Default | What it does |
|---|---|---|---|
| signature | CapturedSignature | What to show. | |
| onLine | boolean | false | Inside SignatureLine: a drawing sits on the line exactly as drawn. |
| padHeight | number | 180 | With onLine: the pad it was drawn on, so it shows 1:1. |
SignatureLine
| Prop | Type | Default | What it does |
|---|---|---|---|
| height | number | 120 | Height in CSS pixels. |
| below | number | 24 | Space under the line. signatureLineFor(padHeight) gives a pad's geometry. |
SignatureFontPicker
| Prop | Type | Default | What it does |
|---|---|---|---|
| text | string | The name to show in each face. | |
| value | SignatureFontId | The chosen face. | |
| onChange | (id: SignatureFontId) => void | Arrow keys move between faces. | |
| labelledBy | string | Id of a visible label; otherwise named "Signature font". |
SignaturePad
| Prop | Type | Default | What it does |
|---|---|---|---|
| onChange | (png: string | null) => void | Base64 PNG, cropped to the ink at full height. | |
| height | number | 180 | Height in CSS pixels. The line sits at 74%. |
| lineWidth | number | 2.5 | Stroke width. |
Sheet
One task at a time on a phone: it rises from the bottom within thumb reach, and is a centred dialog on wider screens. Focus stays inside, Escape and a tap outside close it, and the actions stay visible while the content scrolls.
Props: Sheet
Sheet
| Prop | Type | Default | What it does |
|---|---|---|---|
| open | boolean | Shown as a modal dialog while true. | |
| onClose | () => void | Escape, the × button and a tap outside. | |
| title | ReactNode | Heading; also the dialog's name. | |
| description | ReactNode | One line under the title. | |
| footer | ReactNode | Actions, kept visible while the content scrolls. |
One-time code
Six boxes over one real input, so paste, autofill from the email and screen readers work. It submits by itself when the sixth digit arrives.
The code is wrong or has expired.
Props: OtpInput
OtpInput
| Prop | Type | Default | What it does |
|---|---|---|---|
| value | string | The digits so far. | |
| onChange | (v: string) => void | Digits only. | |
| onComplete | (v: string) => void | Called when the last digit arrives. | |
| busy | boolean | false | Checking: read-only but still focusable and readable. |
| invalid | boolean | false | Red boxes; pair with describedBy. |
| length | number | 6 | Number of digits. |
| id | string | Required: the id of the real input, for its label. | |
| describedBy | string | Id of the error or hint text. | |
| disabled | boolean | false | Not usable at all. Prefer busy while checking. |
Steps and progress
Steps tell where the person is in the flow. The checklist tells what is left before they can finish, with a bar that turns green when they can.
- 1Confirm it's you
- 2Review and fill in
- 3Sign
- Confirm it's you (done)
- 2Review and fill in
- 3Sign
- Confirm it's you (done)
- Review and fill in (done)
- 3Sign
- Required fields filled in (done)
- Add your signature
- Confirm you agree
- Required fields filled in (done)
- Add your signature (done)
- Confirm you agree (done)
Props: Steps, ProgressBar, Checklist
Steps
| Prop | Type | Default | What it does |
|---|---|---|---|
| steps | string[] | Three or four short step names. | |
| current | number | Index of the current step; earlier ones show a check. | |
| label | string | "Progress" | Name of the list for screen readers. |
ProgressBar
| Prop | Type | Default | What it does |
|---|---|---|---|
| value | number | Done so far. | |
| max | number | Total. | |
| label | string | What it measures, for screen readers. | |
| done | boolean | false | Turns green when the person can finish. |
Checklist
| Prop | Type | Default | What it does |
|---|---|---|---|
| items | { ok, label, onSelect? }[] | What is left. Open items with onSelect take the person there. |
Callouts
Information inside a page. Tone always comes with an icon, and with a title when the message is more than one line.
Sandbox document
Seal verified
Identity not verified
The code is wrong or has expired
Props: Callout
Callout
| Prop | Type | Default | What it does |
|---|---|---|---|
| tone | "info" | "success" | "warning" | "danger" | "neutral" | "info" | Always with its icon. Danger is announced. |
| title | ReactNode | Bold first line. | |
| action | ReactNode | A button or link under the text. | |
| role | "alert" | "status" | Announce it. Danger is an alert by default. |
People and status
Who is part of the envelope and where each person is. The current person is blue; status is a word, never only a colour.
- Ada Example (you)Signed
- Bo SampleInvited
- Cy DemoWaiting for their turn
- Dee TestDeclined
Props: PersonList, Avatar, StatusPill
PersonList
| Prop | Type | Default | What it does |
|---|---|---|---|
| people | { name, you?, status, label }[] | Status is a word in a pill, never only a colour. |
Avatar
| Prop | Type | Default | What it does |
|---|---|---|---|
| name | string | Initials are taken from it. | |
| highlight | boolean | false | The current person, in the accent. |
| size | "sm" | "md" | "md" | 32 or 36 px. |
StatusPill
| Prop | Type | Default | What it does |
|---|---|---|---|
| status | "signed" | "declined" | "waiting" | "pending" | Colour follows the word: signed green, declined red, waiting blue (their turn has not come), pending grey (invited, not acted yet). |
Downloads
A file and what it is for, so a signer knows which one to keep.
Props: DownloadTile
DownloadTile
| Prop | Type | Default | What it does |
|---|---|---|---|
| href | string | The file. | |
| title | string | What the file is. | |
| hint | string | What it is for. | |
| download | string | File name to save as. |
Outcomes
One card per screen that ends a flow: done, declined, waiting.
Thank you, you have signed
It is not your turn yet
You declined to sign
Props: StatusCard
StatusCard
| Prop | Type | Default | What it does |
|---|---|---|---|
| title | string | The outcome, as the page's h1. | |
| icon | ReactNode | One icon in the tone's colour. | |
| tone | "info" | "success" | "danger" | "neutral" | "neutral" | Same names as Callout. |
| headingLevel | 1 | 2 | 3 | 1 | 1 when the card is the page's outcome. |
Buttons and inputs
The primitives everything above is made of. One primary button per view.
Props: Spinner
Spinner
| Prop | Type | Default | What it does |
|---|---|---|---|
| size | number | 16 | Inside a busy button, next to its label. |
Helpers
The functions and hooks the kit exports.
| Name | Signature | What it does |
|---|---|---|
| accentProps | (accent?: string | null) => props | Theme a signing surface. Light custom colours are darkened to 4.5:1. |
| readableAccent | (hex: string) => string | The colour, or the same hue darkened until white text on it reaches 4.5:1. |
| contrastOnWhite | (hex: string) => number | WCAG contrast of white text on the colour. |
| signatureLineFor | (padHeight: number) => { height, below } | SignatureLine props that match a SignaturePad, so a drawing shows 1:1. |
| initials | (name: string) => string | Up to two initials, for Avatar. |
| scrollToField | (id: string) => void | Scroll a field into view and focus its control. |
| useCompactLayout | (query?: string) => boolean | True below 1024 px (or for the media query given). |
| useTargetDirection | (id: string | null) => "up" | "down" | null | Where an element is relative to the screen; null while it is visible. |