Chewypixel component
Image Lightbox
A thumbnail that flies out to a larger view in the middle of the screen, over a lightly blurred page.
Installation
npx shadcn@latest add https://chewypixel.io/r/image-lightbox.jsonUsage
import Image from "next/image";
import { ImageLightbox } from "@/components/ui/image-lightbox";
export function ProductPhoto() {
return (
<ImageLightbox src="/products/gumdrops.jpg" alt="A jar of gumdrops" className="rounded-xl">
<Image src="/products/gumdrops.jpg" alt="" width={240} height={160} className="rounded-xl object-cover" />
</ImageLightbox>
);
}Props
srcThe full-size image.
string
altDescribes the image. It's also shown as the title above it.
string
roundOpens as a circle, for avatars.
boolean = false
unoptimizedSkips Next.js image optimization for the full-size image. Remote images need it, or their host in images.remotePatterns.
boolean = false
childrenThe thumbnail. Any element works.
ReactNode
Released under the MIT License.
More components
- Segmented ControlMutually exclusive options with a highlight that slides to the selected one.
- TabsUnderline tabs. The underline slides to the active tab and resizes to fit its label.
- SwitchA switch whose thumb springs across when toggled and stretches while pressed.
- CheckboxA checkbox that draws its check mark and squishes when pressed.
See them in a real app
These components come from Mochi, our admin dashboard template built with Next.js, shadcn/ui and Motion.