Skip to content
Klarhimmel UI

Gallery, mosaic

Gallery, mosaic previewGallery, mosaic preview

Install

npx shadcn add https://ui.klarhimmel.com/r/gallery-mosaic.json
DetailsAbout, usage, props and more

Photos edge to edge with no gaps on a three-column grid, one and two columns wide in turn, so each pair of rows reads as a mosaic. Stacked full width on a phone.

Import

Import

import Block from '@/components/klarhimmel/blocks/gallery-mosaic';
Also called
  • gallery/mosaic
Category
A grid of images with captions. New project? Set it up once: /get-started/installation.

Notes

When to use it

Photos edge to edge with no gaps on a three column grid, one and two columns wide in turn, so each pair of rows reads as a mosaic. Use gallery-grid for captions.

Writing for it

- Choose photographs that crop well to both a single and a double width, since the layout decides which is which. - Write the section label for assistive tech as what the photos show, because it is read aloud and never drawn. - Use a number of photos that fills whole rows, so the last row has no gap.

Watch out for

On a wide screen the second and third of every four are two columns wide, and on a phone they stack at full width. Portrait photographs crop hard in the wide slots.

Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import GalleryMosaic from '@/components/klarhimmel/blocks/gallery-mosaic';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <GalleryMosaic props={{
          "label": "Name what the photos show",
          "photos": [
            {
              "src": "/pictures/photo-barber1.avif",
              "alt": "An empty barbershop with chairs and mirrors"
            },
            {
              "src": "/pictures/photo-bike3.avif",
              "alt": "A bicycle in a workshop with tools on the wall behind"
            },
            {
              "src": "/pictures/photo-book3.avif",
              "alt": "A wooden shelf of books"
            },
            {
              "src": "/pictures/photo-brk1.avif",
              "alt": "A breakfast plate of fruit with orange juice"
            }
          ]
        }} />
      </BlockSurface>
    </Theme>
  );
}

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.

PropTypeDefaultDescription
labelstring'Name what the photos show'Text, up to 48 characters.
photosMedia[]4 itemsList of 4 to 8.