shadcn.io is not affiliated with official shadcn/ui
Digital Signature Account Block for React
A signature and the key behind it: key facts with a fingerprint and a public key download, a signature pad with a typed route, the signature at three sizes, and a new key that asks first.
Installation
Overview
Let people set the signature that goes on what they sign, with this signature panel for React with Base UI. A hairline frame with a plus mark on each corner puts the signing key's facts at the start (the algorithm, the holder, the days it was made and ends, a fingerprint with a Copy Button and a download of the public key) and the signature itself at the end, in two ways. Draw uses the catalog Signature Pad, whose strokes become SVG paths: there is no canvas, and its Clear arrow starts again. Type is the keyboard's way in: a typed name in a script face that says plainly it is not a handwritten signature. A Segment Group switches between them and the Shine Button saves. Under them the saved signature appears at the three sizes it is used at, on contracts, approvals and emails. Generate a new key asks first in an Alert Dialog. It's built from Signature Pad, Segment Group, Alert Dialog, Copy Button, Download Trigger, Input, Button, Shine Button and Guides, with a CSS entrance only. For a contract, approval or e-signature app.
FAQ
Is the key real, and is anything signed?
The key is a fake public key made for the demo: its private half was thrown away when it was made, so nothing can be signed with it. The fingerprint is real, the SHA-256 of the key's bytes worked out in the page, and the public key downloads as a real PEM file. The signature here is only a picture kept in this page: no document is signed and nothing is sent. Never put a private key in a page.
How does drawing work, and what if I can't draw?
The signature pad takes a pointer (finger, pen or mouse). Its strokes are kept as SVG paths and the saved signature is those paths scaled to fit, so it stays sharp at any size and no image is made. A pad can't be used with a keyboard alone, so Type is the other route: Tab to Draw or Type, choose Type and write your name. The typed version is a script face and the panel says it is a stand-in for a handwritten signature, not one.
What does Save do?
It keeps the drawn or typed signature for this page, shows it in the three places it appears, and says so in the status line. The button rests quietly until there is something to save and, if pressed early, says what is missing. Undo walks back the last change. To make it real, send the strokes (or the typed name) to your server in save and show what it returns.
What does a new key change?
Generate a new key opens an alert dialog that says the old key's signatures stay valid, with focus on Keep my key. Confirming swaps the facts and the fingerprint to the new key's and the button rests as "New key made", so another needs an Undo first. In a real app the old public key stays published so earlier signatures can still be checked.
What stays local?
Everything: the drawing, the typed name, the saved signature and the new key. A reload starts again. Copy and the public key download are real: they copy and save the typed values.
Is it accessible, and how does it look on a phone?
Draw and Type are a named choice with arrow keys, the pad has a name and a Clear button with a name, and every action says what it did in a polite live region. The key's facts are a real description list and the places the signature appears are a real list. On a phone the key facts come first, the pad is full width and 160 pixels high, and the foot with Undo stays pinned.
Related
- Pro
Client Certificates Account
Sign-in methodsThe certificates that sign an account in on a device: ruled rows with the issuer, the end date and days to go, a details row with serial number and fingerprint, Renew, Revoke and an add dialog.
- Pro
Verification Record Account
VerificationWhat an account has proven and when each proof ends: four rows with the method, the day and a derived end date, a due-soon state, one band that takes a six-digit code or a name, and Undo.
- Pro
Identity Wallet Account
VerificationA wallet of verified credentials: three cards in an inset frame, a shop's request for the chosen one with what it would and would not see, an optional extra switch and a Share button.
- Pro
Passkeys Account
Sign-in methodsAn account's passkeys: a ruled list of what each one is, when it was created and last used, a name you edit in place, a guarded Remove, and a dialog from the header that names a new passkey.
- Pro
A full-height confirmation after the last signature: a Signed stamp beside the heading, the completion record as a six-event table with fixed UTC times, the document hash with a real copy button, and a real .txt download of the record.
- Pro
Verified Addresses Account
VerificationThe addresses on an account with which are proven by a postcard code: three ruled rows with one primary, a verify band with a code field and a resend, a form that checks the postal code by country, and Remove with Undo.