UI kit reference
components/Lightbox
import { … } from 'zidane-ui'ui/src/components/Lightbox.tsx
Functions#
useLightboxFunction#
Owns the state of an attachment lightbox. Returns open(items, index, origin?), which
shows the gallery at index (clamped to the list; an empty list is ignored) and grows
the image out of the origin thumbnail, close(), and element, which the caller
renders once. It is null while the lightbox is closed.
function useLightbox(): { close: () => void; element: Element | null; open: (items: readonly LightboxItem[], index: number, origin?: HTMLElement | null) => void }Returns
{ close: () => void; element: Element | null; open: (items: readonly LightboxItem[], index: number, origin?: HTMLElement | null) => void }Interfaces#
LightboxItemInterface#
One attachment shown in the lightbox: an image, or a text preview drawn by body.
interface LightboxItemProperties
| Name | Type | Description |
|---|---|---|
| body? | () => ReactNode | Renders the item's content when it has no |
| key | string | Stable identifier for the item. |
| name | string | Name shown as the caption, and used as the image's alt text and the dialog's label. |
| src? | string | Image source. Items without one render |