Componentmedia1.59 KB gzipZero dependencies
Lightbox
Fullscreen media viewer with film frame edges and image paging.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add lightboxOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { Lightbox } from "@/components/ui/lightbox"; <Lightbox open={open} onOpenChange={setOpen} images={[{ src: "/pass.png" }]} />Source code
lightbox.tsx + 2 helpersZero third-party dependencies (3 local files shown in tabs below).
tsxlightbox.tsx153 lines
"use client"; import * as React from "react";import { getFocusable, lockBodyScroll, registerEscapeLayer, trapFocus } from "./lib/focus-trap";import { cn } from "./lib/utils"; export interface LightboxImage { src: string; alt?: string; title?: string;} export interface LightboxProps extends React.HTMLAttributes<HTMLElement> { open: boolean; onOpenChange: (open: boolean) => void; images: LightboxImage[]; initialIndex?: number; className?: string;Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { Lightbox } from "@/components/ui/lightbox"; <Lightbox />| Prop | Type | Description |
|---|---|---|
| open | boolean | Controlled open visibility state. |
| onOpenChange | (open: boolean) => void | Callback invoked on open change. |
| images | LightboxImage[] | Configures images. (Default: []) |
| initialIndex | number | Configures initial index. (Default: 0) |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |