Lightbox
Full-screen image gallery with thumbnails and keyboard navigation.
Import
tsx
import { Lightbox } from "@cronus-ui/ui";
bash
npx cronus-ui add lightbox
Examples
.cronus
The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.
default.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component LightboxDefault layout:inline style:lightbox {
aria-label:"Image gallery"
label "Image gallery"
text "First image"
text "Second image"
}
page "/audit/lightbox/default" type:custom {
use LightboxDefault
}
API Reference
Generated from the component's exported types.
LightboxLabels
| Prop | Type | Default | Description |
|---|---|---|---|
gallery* | string | — | — |
close* | string | — | — |
previous* | string | — | — |
next* | string | — | — |
viewImage* | (index: number) => string | — | — |
counter* | (current: number, total: number) => string | — | — |
LightboxProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
images* | LightboxImage[] | — | The images to display in the gallery. |
open | boolean | — | Controlled open state. |
onOpenChange | (open: boolean) => void | — | Called when the open state should change. |
defaultOpen | boolean | false | Uncontrolled initial open state. |
index | number | — | Controlled active image index. |
onIndexChange | (index: number) => void | — | Called when the active index should change. |
defaultIndex | number | 0 | Uncontrolled initial index. |
labels | Partial<LightboxLabels> | — | Override default English strings. |
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |