Keyframery

Wave Photo Upload

New
PNG, JPG or WebP, up to 10 MB⌘V pastes one

Try
Drop or paste a photo of your own, or try one of these.

Installation

npx shadcn add @keyframery/wave-photo-upload

Props

PropTypeDefaultWhat it does
upload(file, report, signal) => Promise—Sends the photo. Call report with 0 to 1 as it goes and throw if it fails. Leave it out and the photo prints at its own pace.
onChange(file: File | null) => void—Runs with the photo once it's in, and with null when it's removed.
acceptstring[]["image/png", "image/jpeg", "image/webp"]The file types it takes. The error message lists them by name.
maxSizenumber10 MBThe largest file it takes, in bytes.
aspectnumber—Keeps the frame one shape (width ÷ height), like 1 for an avatar. By default it takes each photo's shape.
disabledbooleanfalseStops it taking photos.
ref{ pick(file), clear() }—Start with a file you already have, as if it had been dropped, or remove the photo.

Accessibility and motion

  • Underneath it's a real file field: the frame is a button that opens the file picker, and screen readers hear the progress and the result.
  • fetch can't report upload progress yet, so the example uses XMLHttpRequest. Anything that calls report with 0 to 1 will do.
  • With reduced motion on, nothing moves: the photo simply fades in as it uploads.

On this page