ImageViewer
Expand an image into a focused, gesture-friendly viewer.
Preview
Usage
image-viewer.tsx
import "useintkit/styles.css";
import { ImageViewer } from "useintkit";
<ImageViewer
src="/images/coast.jpg"
alt="A quiet coastline"
caption="An afternoon by the sea"
/>Image gallery
Show one to four images in a responsive grid. Each image opens in the viewer. ImageGallery is available in useintkit@0.0.1 and later.
image-gallery.tsx
import { ImageGallery } from "useintkit";
<ImageGallery
images={[
{ src: "/images/coast.jpg", alt: "A quiet coastline" },
{ src: "/images/mountain.jpg", alt: "A mountain view" },
]}
style={{ maxWidth: 480, maxHeight: 400 }}
/>Set the gallery’s width, height, and maximum dimensions with its style or className. Use --ik-image-max-width and --ik-image-max-height to limit expanded images.
Props
| Prop | Type | Description |
|---|---|---|
| src | string | Required. Full-size image URL. |
| alt | string | Required. Descriptive alternative text. |
| thumbnailSrc | string | Optional thumbnail URL; defaults to src. |
| caption | ReactNode | Optional content beneath the expanded image. |
| open / onOpenChange | boolean / function | Control the viewer from your application. |
| defaultOpen | boolean | Initial state when uncontrolled. |
Escape, the backdrop, the close button, or a deliberate drag dismisses the viewer. Focus returns to the trigger.