Page scanner Pro
One payment, every Pro piece. $11 tomorrow.
Install
npx shadcn@latest add @mu-pro/page-scannerPro. Installs with your licence key through the @mu-pro registry; the key comes with Pro. Lands in components/mu/page-scanner/ with the shared foundation.
Usage
import { PageScanner } from "@/components/mu/page-scanner/PageScanner";
<PageScanner
fields={[
{ label: "Name", value: "Ada Moreau" },
{ label: "Date", value: "14 Nov 2026" },
{ label: "Total", value: "$1,284.00" },
]}
onComplete={() => console.log("scanned")}
/>Source
How it works
Building with an agent? Hand it a ready prompt for this piece.
Input and reduced motion
- Files: drop a file on the scanner (with a pointer), or press the round key (pointer, touch or keyboard: Tab to it, Enter or Space) to open the file picker. While a file is held over the scanner its lamp warms to its return glow and the caption says "Drop to scan" with the types it takes. Carry it away, drop it elsewhere or press Escape, and both go back.
- Screen readers: the caption's two lines are a polite live region (
role="status"); they announce each page and the completion, not each field. - Reduced motion: a new file's sheet is laid down at once instead of crossfading, and it scans as below. The head stays parked at the top with its line lit, without the blade, the raking tooth or its cast shadow. The page shows each side read without turning (it switches at once) while the caption steps through the pages, then shows side one with every field found, and the lamp goes out. Capsules and the tick fade in without popping or drawing.
Props
| Prop | Default | What it does |
|---|---|---|
fields | three demo fields | up to three { label, value } found on side one, shown as capsules |
pages | 2 | 1 or 2 sides; two-sided pages turn over between passes, and back to side one when done |
secondsPerPage | 2.6 | one read pass down and one return pass up |
runKey | 0 | a number or string; change it to scan again, and the old read fades and the head glides home from wherever it is. Changing pages, secondsPerPage or the number of fields also starts a new scan |
onComplete | — | called once the scan is complete |
labels | English | { scanning, complete, page, found, open, drop, opening, refused, kinds, size, read, broken, untitled, reading, unread }. The counting ones take a function or a template string, so a Server Component can pass them: page ((n, of) or "Page {n} of {of}"), found ((pages, fields) or "{pages} pages · {fields} fields found"), kinds ((pdf), or a plain string), size ((mb) or "Files up to {mb} MB") |
sound | off | sweep and chime for a scan a person started: true, or a volume 0–1 (see Sound) |
source | — | a file (File or Blob: PNG, JPEG, WebP or PDF) or an image URL to scan instead of the invoice; change it to scan another. A Blob with no type (or application/octet-stream) is tried (a PDF is known by its first bytes) and answered as damaged if it won't open. A visitor's own file replaces it until source changes |
allowFiles | true | lets a visitor drop a file on the scanner or pick one with its round key; false hides the key and ignores drops |
pdf | — | loads pdf.js for PDFs (see Your own file); without it the scanner takes images only and says so |
maxFileSize | 10 * 2 ** 20 | the largest file it takes, in bytes (10 MB) |
onFile | — | called with a file a visitor dropped or picked, once it is taken (it is never uploaded; do with it what you like). Return a promise of the fields your backend read from it ({ label, value }[]): the head keeps sweeping side one past its passes and the caption says "Reading your file" (reading) until it settles, then up to three capsules show your fields and the caption counts them; resolve false, reject or throw, and it says "Couldn't read that file" (unread). Return nothing and the file's name is its capsule, as before |
className | — | added to the root |
Sound
Off by default. With sound (or a volume, sound={0.5}) each read pass sweeps and completion chimes, but only for a scan a person started: a new runKey set from their press (the browser's user activation), or a file they dropped or picked (its first scan only: a later scan of the same file needs a press of its own). The scan that plays on its own as it scrolls into view stays silent, and a sweep stops if the scanner leaves the view. setMuted(true) from components/mu/sounds.ts silences every cottoncandy item at once.
Licence
Included with Pro: use it in unlimited end products for you and your clients; no reselling as a kit. See the licence.
A loader that reads while you wait. A machined head sweeps one cool line of light down the paper and back. The print turns to ink behind it, each value it recognises drops into a capsule, and it confirms when the scan is complete.
For document upload and OCRMore in Upload & files