Component packs › Hoist › Image Crop

Image Crop

Crop cuts like a paper trimmer: the blade runs the edges and the four offcuts fall away under gravity.

Image Crop is a crop from Hoist, a component pack with 6 file upload components: File upload components where every file is a paper sheet lifted on a steel cable. Price: $2 for the whole pack.

Built with: canvas Blob output, aspect presets, keyboard move and resize.

Code: React and Next.js (TypeScript), Vue 3, plain HTML/CSS/JS, Tailwind CSS v4 and Motion (motion.dev). No npm packages needed. Keyboard accessible, with a reduced-motion version, in dark and light.

Image Crop props

PropTypeDefaultDescription
srcstringSantorini (Unsplash)Image URL (must allow CORS for the canvas output). Default: Santorini (Unsplash).
altstring
aspectnumber1Aspect ratio w/h; 0 is free. Default 1.
widthnumber360Width in px. Default 360.
darkboolean
onCrop(result: { blob: Blob | null; x: number; y: number; width: number; height: number }) => void
autoplaynumber | falseShowcase mode: moves the frame and crops every N ms while visible.

Methods on the ref

Use it in React

import ImageCrop from './ImageCrop';

<ImageCrop />

The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.

More in Hoist

Good for: File upload.