Square studies of material and surface, opening a viewer that hands you a loupe: a round window you drag across the work, redrawing whatever sits under it from the same file at a configurable magnification.
A grid of surface studies whose viewer hands you a loupe: a round window you drag across the work, redrawing whatever sits under it at the magnification you set.
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.
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
npx shadcn add "https://ui.beste.co/r/gallery21?email=YOUR_EMAIL&license_key=YOUR_KEY"Base UI flavor
npx shadcn add "https://ui.beste.co/r-base/gallery21?email=YOUR_EMAIL&license_key=YOUR_KEY"This installs the block to components/beste/block/gallery21.tsx plus the badge7 eyebrow it uses.
The installed file exports gallery21Demo alongside the block: the exact props behind the preview above. Spread it to get a working gallery in one line.
import { Gallery21, gallery21Demo } from "@/components/beste/block/gallery21";
export default function Page() {
return <Gallery21 {...gallery21Demo} />;
}Then replace the demo with your own props. Written out, a trimmed setup looks like this:
import { Gallery21 } from "@/components/beste/block/gallery21";
export default function Page() {
return (
<Gallery21
badge={{ label: "Surface studies" }}
heading="Close enough to see the tooth of the paper."
magnification={2.5}
studies={[
{
src: "/studies/ground.jpg",
alt: "Matte cotton surface, macro",
title: "Ground, Enlarged",
artist: "Idris Kane",
surface: "Pigment on matte cotton",
},
{
src: "/studies/ply.jpg",
alt: "Plied wool on a spool",
title: "Ply (Second State)",
artist: "Nadia Brühl",
surface: "Undyed wool, unspun ends",
},
]}
labels={{
openLabel: "Take the loupe to this work",
closeLabel: "Put the loupe down",
previousLabel: "Previous study",
nextLabel: "Next study",
loupeLabel: "Move the loupe",
hint: "Press and drag on the work to move the loupe.",
counterSeparator: "of",
}}
/>
);
}| Prop | Type | Default | Description |
|---|---|---|---|
badge | { label: string } | – | Eyebrow label rendered as a Badge7 |
heading | string | – | Section heading in the header row |
studies | Study[] | [] | Works in the grid, in order |
magnification | number | 2.5 | How much the loupe magnifies the surface under it |
labels | Gallery21Labels | {} | Fixed strings that are not content: viewer controls, the loupe label, the hint and the counter separator |
lightbox | boolean | true | Render the built-in viewer; set false to leave the frames static |
className | string | – | Extra classes for the outer <section> |
type Study = {
src: string;
alt: string;
title: string;
artist: string;
surface: string;
};
type Gallery21Labels = {
openLabel?: string;
closeLabel?: string;
previousLabel?: string;
nextLabel?: string;
loupeLabel?: string;
hint?: string;
counterSeparator?: string;
};magnification, positioned in pixels from the measured frame, so the point under the glass is genuinely enlarged rather than shrunk to fit the circle.requestAnimationFrame and again on every move, so the magnification is correct before the first drag and stays correct after a resize.onDragStart calls preventDefault and both images are draggable={false}, because without that the browser starts dragging the picture and cancels the pointer stream mid-gesture.touch-none is set on the frame, so a touch drag moves the loupe instead of scrolling the page.lightbox={false} disables every study button and switches the cursor back to default, leaving a plain grid of surfaces.gallery23
Works listed with the sizes they are printed at, opening a viewer that hangs the piece in a photographed room and scales it as you switch size pills, so the dimensions stop being an abstraction.
gallery10
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.
gallery9
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.
gallery18
Matted edition cards opening a viewer that keeps the whole sheet and its detail crops in one place: pill controls swap what the large frame shows while the side column holds process, sheet size and edition.