Open this example in the interactive library
Live preview
Source code
// components/PrintResolutionCheck.tsx
import { useState } from "react";
export default function PrintResolutionCheck() {
const [pixels, set] = useState(2400);
return (
<label>
Source width in pixels
<input
type="number"
min={0}
value={pixels}
onChange={(e) => set(+e.target.value)}
/>
<output>{(pixels / 300).toFixed(2)} inches at 300 ppi</output>
</label>
);
}
