Gallery, grid


Install
npx shadcn add @klarhimmel/gallery-gridDetailsAbout, usage, props and more
A grid of images with captions under a heading, filled row by row. columns "2" keeps pairs side by side, such as before and after.
Import
Import
- gallery/grid
- About
- A grid of images with captions under a heading, filled row by row. columns "2" keeps pairs side by side, such as before and after. Give items a price and a note to show things for sale.
- Category
- A grid of images with captions. New project? Set it up once: /get-started/installation.
Notes
When to use it
Even grid of equally cropped images with captions under a heading. Use it for a set of similar frames; when the pictures vary in shape, gallery-masonry avoids cropping them all to one ratio.
Writing for it
- You can add one to twelve items. Six or nine fill the three-column layout without a ragged last row. - Captions are 120 characters. A few words naming the thing shown work better than a sentence repeating the alt text. - Use alt text to describe the picture and the caption to say why it is here, so the two do not duplicate each other.
Watch out for
Every image is forced to 4 by 3, which crops portrait photos. Captions are hidden when empty, so mix captioned and uncaptioned items and the rows will have different heights.
Pairs well with
Usage
The block in a page, with its default content (long lists shortened). Every prop is in the table below.
Props
The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.
| Prop | Type | Default | Description |
|---|---|---|---|
eyebrow | string | 'Name the topic' | Text, up to 60 characters. |
title | string | 'Say what the pictures show' | Text, up to 120 characters. |
description | string | 'Say in one line what the pictures s…' | Text, up to 300 characters. |
columns | '2' | '3' | - | One of '2', '3'. Optional; empty is not rendered. |
actions | Link[] | - | List of up to 2. Optional; empty is not rendered. |
tiles | boolean | - | Optional; empty is not rendered. |
titleSize | 'heading' | 'display' | - | One of 'heading', 'display'. Optional; empty is not rendered. |
items | { media, caption, price, note, href }[] | 6 items | List of 1 to 24. Each item: media, caption, price (optional), note (optional), href (optional). |
headingLevel | '1' | '2' | - | One of '1', '2'. Optional; empty is not rendered. |