Zoomable Justified Gallery

(Fit or fill)

Open a frame, then push it to full size.

Click the picture to switch between fit and fill.

About this block

Zoomable Justified GalleryPRO

Justified rows of frames that grow to fill every line, opening a viewer whose picture doubles as the zoom control: clicking switches between fitting the screen and filling it, with the caption and controls on one closing rule.

A justified wall with no ragged edge, opening into a viewer where the picture itself is the zoom control: fit to the screen by default, filling it on click.

Upgrade to Pro

Pro blocks install through the shadcn CLI with your license key and ship their full source. Docs and live previews stay open to everyone, so you can read every block's details first.

Upgrade Now

Installation

Swap YOUR_EMAIL and YOUR_KEY for the email and license key on your account. Find your license key on your account page.

Radix flavor

bash
npx shadcn add "https://ui.beste.co/r/gallery9?email=YOUR_EMAIL&license_key=YOUR_KEY"

Base UI flavor

bash
npx shadcn add "https://ui.beste.co/r-base/gallery9?email=YOUR_EMAIL&license_key=YOUR_KEY"

This installs the block to components/beste/block/gallery9.tsx plus the badge7 eyebrow it uses.

Quick start

The installed file exports gallery9Demo alongside the block: the exact props behind the preview above. Spread it to get a working gallery in one line.

tsx
import { Gallery9, gallery9Demo } from "@/components/beste/block/gallery9";

export default function Page() {
  return <Gallery9 {...gallery9Demo} />;
}

Then replace the demo with your own props. Written out, a trimmed setup looks like this:

tsx
import { Gallery9 } from "@/components/beste/block/gallery9";

export default function Page() {
  return (
    <Gallery9
      badge={{ label: "Fit or fill" }}
      heading="Open a frame, then push it to full size."
      frames={[
        { src: "/macro/matte.jpg", alt: "Matte surface macro", caption: "Matte surface, macro", meta: "Studio, February" },
        { src: "/macro/edge.jpg", alt: "Brushed edge in low light", caption: "Brushed edge", meta: "Studio, February" },
      ]}
      labels={{
        openLabel: "Open this frame",
        closeLabel: "Close the viewer",
        previousLabel: "Previous frame",
        nextLabel: "Next frame",
        zoomInLabel: "Fill the screen",
        zoomOutLabel: "Fit the screen",
        counterSeparator: "of",
        hint: "Click the picture to switch between fit and fill.",
      }}
    />
  );
}

Props

PropTypeDefaultDescription
badge{ label: string }Eyebrow label rendered as a Badge7
headingstringSection heading in the header row
framesFrame[][]Pictures on the wall, in order
labelsGallery9Labels{}Fixed strings that are not content: viewer controls, zoom labels, counter separator and the hint
lightboxbooleantrueRender the built-in viewer; set false to leave the frames static
classNamestringExtra classes for the outer <section>
ts
type Frame = {
  src: string;
  alt: string;
  caption: string;
  meta: string;
};

type Gallery9Labels = {
  openLabel?: string;
  closeLabel?: string;
  previousLabel?: string;
  nextLabel?: string;
  zoomInLabel?: string;
  zoomOutLabel?: string;
  counterSeparator?: string;
  hint?: string;
};

Behavior notes

  • The wall is flex flex-wrap with grow basis-72 on every frame, so each row stretches to the full width and the last row has no ragged right edge whatever the count.
  • Inside the viewer the picture is itself a button: fit is object-contain with a radius, fill is size-full object-cover with none, and the cursor switches between zoom-in and zoom-out to say which is available.
  • The zoom state resets to fit whenever a frame is opened or stepped, so a new picture never arrives already cropped.
  • The transition is on the image class rather than a transform, so switching between fit and fill eases instead of jumping.
  • The same zoom action is duplicated as a labelled control in the toolbar, so the interaction is reachable by keyboard and its label swaps with the state.
  • Escape closes and the left and right arrows step through, wrapping in both directions.
  • Setting lightbox={false} disables every frame button and switches the cursor back to default, leaving a plain justified wall.
  • Viewer tokens are fixed background shades on a bg-foreground/95 surface, correct for a panel that is dark in both themes.

More Gallery blocks

View all Gallery
PRO

gallery3

Filterable Album Grid

Album gallery with pill filters that swap the whole set below, where any tile opens a light full-screen viewer: the frame hangs on the page surface while a side column carries the caption, the album summary, the controls and a plainly labelled thumbnail index.

PRO

gallery6

Mosaic Full Screen Viewer

Dense caption-free mosaic where every tile carries an expand seal and opens a full-screen viewer with arrow controls on the picture, escape and arrow keys, a counter, the caption and a thumbnail filmstrip.

PRO

gallery2

Lightbox Frame Grid

Captioned image grid where any tile opens a full-screen lightbox on a dark scrim, with a frame counter, keyboard arrows, escape to close and previous and next controls beside the caption.

PRO

gallery10

Overview Toggle Viewer

Square grid whose viewer holds two states: a single frame with caption and controls, or an in-place overview of the whole set that you can jump from without closing the layer.

PRO

gallery11

Full Bleed Strip With Sheet Viewer

Edge-to-edge strip of tall frames opening a viewer where the picture fills the screen and the caption, note and thumbnails sit in a sheet that slides off the bottom when you want the frame uncovered.

PRO

gallery8

Photo Book Spread Viewer

Photographs presented as printed spreads on a soft panel: two plates share a page with a centre rule, round controls turn to the next spread, and a bar index below tracks how far through the book you are.