Transform how you display images in your React applications with our lightweight component that dynamically zooms into the most interesting parts of each image. Integrating seamlessly with your existing setup, it unlocks advanced features like srcset and static site generation, all while keeping your bundle size under 5kB.
Introducing react-image-display-control, an innovative React component designed to enhance your web applications with next-gen responsive image handling. This lightweight solution (under 5kB) effortlessly integrates with any <img>
-like element, providing automatic and responsive zooming capabilities focused on the most relevant parts of your images.
Features
- Smart Image Zooming: Automatically retrieves and zooms into the most interesting regions of your images based on embedded metadata, ensuring your visuals stand out.
- Seamless Integration: Works flawlessly with popular frameworks such as Next.js and Vite without altering your existing DOM structure, keeping your CSS rules intact.
- Support for Image Candidates: Easily utilize image candidates (srcset) to deliver optimal visual experiences across devices.
Getting Started
Incorporating the Image Display Control component is simple and straightforward. With just a few lines of code, you can upgrade your image rendering:
import { ImageDisplayControl } from "@frameright/react-image-display-control";
export default function MyComponent() {
return (
<ImageDisplayControl>
<img
src="https://react.frameright.io/assets/pics/skater.jpg"
width="200"
height="200"
/>
</ImageDisplayControl>
);
}
The resulting HTML element is responsive and adapts automatically when resized, such as switching from portrait to landscape view on mobile devices.
Benefits of Using react-image-display-control
- Enhanced User Experience: By utilizing smart zoom features, you draw user attention to the focal point of your images, improving engagement.
- Developer Friendly: Quick setup and compatibility with major React-based projects, making it an ideal choice for developers aiming to enhance their applications without extensive modifications.
Additional Resources
- 🎨 Live Demo
- 🔗 CodeSandbox Example
- 💻 Documentation
Elevate your React applications with responsive and intelligent image handling today!