Masonry — Gallery block
Freegallery-masonry · for home, landing, article pages
Masonry
A handful to a dozen pictures of mixed shapes, read top to bottom in columns, each with its caption: a general gallery
Documentation
Installation
One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).
pnpm dlx shadcn-vue@latest add @trame/gallery-masonryUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import GalleryMasonry from '@/components/trame/blocks/gallery/gallery-masonry.vue'
const props = {
title: "Trail notebooks",
intro: "Pictures taken along the way, lightly edited, by the studio team.",
images: [
{
src: "https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=1600&q=80",
alt: "A snowy ridge at sunrise, above a sea of clouds",
caption: "Needle Ridge, 6:40 a.m., the first day of the crossing."
},
{
src: "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=1600&q=80",
alt: "A trail through a forest of tall trees",
caption: "Under the tall trees, before the climb."
}
],
action: {
label: "See the whole series",
action: "page",
record: {
id: "carnets"
}
}
}
</script>
<template>
<GalleryMasonry v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title | string | Wordsthe gallery’s heading, if it needs one |
| intro | string | Wordsone or two lines under the heading |
| images* | Image[] | the pictures in the order the author wants them read |
| action | Action | the call to action: its words and the page action it runs |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Image images[] · 3 props
| Prop | Type | Description |
|---|---|---|
| src* | string | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| alt* | string | Wordswhat the picture shows, in a sentence: required, it is the picture for those who do not see it |
| caption | string | Wordsthe author’s caption, if the picture has one |
Action action · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhat happens ("See the series", "Order a print") |
| action* | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action opens, if any |
Options options · 1 props
| Prop | Type | Description |
|---|---|---|
| mood | 'inverse' | 'brand' | 'warm' | 'tint' | string | a band of the page that redefines the theme surfaces inside it |
What it asks your app for
The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).
| Member | What it is for |
|---|---|
| href | the address an action leads to, or null to hide what leads there |
| act | runs a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error } |
| can | whether the page has this action |
| asset | a picture’s address as your app serves it |
| Link | your router’s link component |
| cartCount | the cart badge’s number |
| cartDrawer | whether your app has a cart drawer |
| cartOpen | whether the cart drawer is open |
| label | your word for an interface key, or undefined to keep the block’s own |
The words it says itself, in English and French; label(key) replaces any of them:
| Key | English | French |
|---|---|---|
| newsletter.already | You are already subscribed. | Vous êtes déjà inscrit. |
| newsletter.done | Done: you are subscribed. | C’est noté : vous êtes inscrit. |
| newsletter.invalid | Check the email address. | Vérifiez l’adresse e-mail. |
| newsletter.tooMany | Too many attempts, try again in a moment. | Trop de tentatives, réessayez dans un moment. |
Features
- Every word in the server HTML
- Same markup in Vue and React
- Theme tokens only: every theme, light and dark
- Shows what you give it, invents nothing
- Expressive motion, within its budget; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
action
A gallery section, for home, landing, article pages; it uses class-variance-authority, clsx, motion, reka-ui, tailwind-merge.
Built with
The components this block is made of; each one installs on its own too.
More gallery blocks
- Featured image frame study: one picture shown large with its caption in mono, its table of facts and one action (order a print): a single image that deserves a page.
- Making of rail: tall step cards in a row that scrolls sideways, a large number over each picture and a bar showing how far along the row is: a home or product band that shows the making in a glance; the merchant’s own workshop only.
- Making of stacked cards: one wide card per step, picture and words side by side, the cards piling up on each other as the page scrolls: three to eight steps told one at a time, on a brand or story page; the merchant’s own workshop only.
- Making of thread: the steps alternating left and right along a vertical thread that fills as the page scrolls, a numbered knot for each: a longer making-of (six to twelve steps) read from top to bottom; the merchant’s own workshop only.
- Media credits list: A quiet production ledger ordered by the supplied entries; the merchant’s own only.
- Media credits sessions: Session cards with credited context and a link to the recording; the merchant’s own only.
- Photo essay full bleed: each chapter opens on a title and its pictures run edge to edge, drifting slowly, with a narrow caption under each: a few very strong pictures that need the whole width.
- Photo essay pinned captions: a caption column that stays in view while the chapter’s large pictures scroll past: a trip, a making-of or a reportage told picture by picture.