MD-04Media
Photo Straighten
Level a crooked photo on a ruler you drag or flick. The crop grows to hide the corners, and a grid shows while you adjust.
PROAudio Player Card and more like it are in Kokonut UI Pro
Installation
Photo Straighten is a free, open-source React component in the Kokonut UI Media collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/photo-straighten.tsx, so the code is yours to change.
npx shadcn@latest add @kokonutui/photo-straightenOr add it by hand: install its packages, then copy the source from Copy code above into components/kokonutui/photo-straighten.tsx.
npm install lucide-react motionUsage
import PhotoStraighten from "@/components/kokonutui/photo-straighten";
export default function Example() {
return <PhotoStraighten />;
}Props
srcstringDefault built-inaltstringDefault "A lake below mountains"aspectRationumberDefault 4 / 3Width over height of the crop.
tiltnumberDefault 4.2How crooked the photo is, in degrees; what Auto corrects. The demo tilts its photo by this much so there is something to fix.
defaultAnglenumberDefault 0onAngleChange(degrees: number) => voidclassNamestringExtra classes for the root element.
Dependencies
| Needs | Version | Comes from |
|---|---|---|
lucide-react | ^0.556.0 | npm, installed by the CLI |
motion | ^12.23.25 | npm, installed by the CLI |
cn from lib/utils.ts | shadcn init | |
| React | 19 | Your app |
| Tailwind CSS | 4 | Your app |
No provider, font or global CSS to set up: the file works as soon as it lands.

