# Lightbox

> A grid of thumbnails. Each one grows into a full-screen view you can step or swipe through.

```tsx
import { Lightbox } from '@brand-studio/ui';
import { beans, cameraViews, cup, pour } from '@/demos/assets';

export default function LightboxDemo() {
  return (
    <div style={{ width: '100%', maxWidth: 720, padding: '32px 0' }}>
      <Lightbox label="Field notes" images={[cup, beans, pour, cameraViews[0], cameraViews[2], cameraViews[5]]} />
    </div>
  );
}
```

## Installation

```sh
npm install @brand-studio/ui
```

React 18 or 19 is a peer dependency. Import the stylesheet once and wrap the app in a brand theme:

```tsx
import '@brand-studio/ui/styles.css';
import { BrandTheme, Lightbox } from '@brand-studio/ui';
import brand from './brand.json';

<BrandTheme palette={brand.tokens} mode="system">
  {/* your app */}
</BrandTheme>
```

## Usage

```tsx
import { Lightbox } from '@brand-studio/ui';
```

```tsx
<Lightbox label="Field notes" images={images} />
```

### Masonry

Set `layout="masonry"` to keep each image's own shape in columns.

```tsx
import { Lightbox } from '@brand-studio/ui';
import { beans, cameraViews, cameraWides, cup, pour } from '@/demos/assets';

export default function LightboxMasonryDemo() {
  return (
    <div style={{ width: '100%', maxWidth: 720, padding: '32px 0' }}>
      <Lightbox layout="masonry" label="Contact sheet" images={[cup, cameraViews[0], cameraWides[1], beans, cameraViews[3], pour, cameraWides[0], cameraViews[5]]} />
    </div>
  );
}
```

## Accessibility

- Thumbnails are buttons named by their image's alt text.
- The full view is a native modal dialog: focus stays inside, Escape closes it and focus returns to the thumbnail.
- Arrow keys step through images and the counter is announced.
- With reduced motion the view opens and closes without growing.

## API Reference

| Prop | Type | Default |
|---|---|---|
| `images` | `ImageAsset[]` | – |
| `label?` | `string` | `'Gallery'` |
| `layout?` | `"grid" \| "masonry"` | `'grid'` |
| `className?` | `string` | `''` |

Source: https://brandstudio.js.org/docs/components/lightbox/
