Skip to content
Klarhimmel UI

Gallery, scroll strip

Gallery, scroll strip previewGallery, scroll strip preview

Install

npx shadcn add @klarhimmel/gallery-strip
DetailsAbout, usage, props and more

A single row of same-height images that scrolls sideways with snap points and keyboard focus. Takes little height, so it fits between sections.

Import

Import

import Block from '@/components/klarhimmel/blocks/gallery-strip';
Also called
  • gallery/strip
About
A single row of same-height images that scrolls sideways with snap points and keyboard focus. Takes little height, so it fits between sections. The label names the region for screen readers.
Category
A grid of images with captions. New project? Set it up once: /get-started/installation.

Notes

When to use it

A single row of same-height images that scrolls sideways with snap points, so it takes little vertical space between sections. When every image should be visible without scrolling, use gallery-grid.

Writing for it

- Add three to ten items. Fewer than three are not allowed, since a strip needs something to scroll past. - Write stripLabel (60 characters) as a sentence that names the photos and says to scroll sideways, for example 'Photos of the neighbourhood, scroll sideways'. - Captions hold 100 characters and sit under each 4 by 3 image, so keep them to a place name or a few words.

Watch out for

The strip label is hidden from sight on the live page and only read by screen readers, but it is shown in the editor. The scroll region takes keyboard focus, so a page with several strips adds several tab stops.

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 GalleryStrip from '@/components/klarhimmel/blocks/gallery-strip';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <GalleryStrip props={{
          "eyebrow": "Name the topic",
          "title": "Say what the pictures show",
          "description": "Say in one line how far away they are.",
          "stripLabel": "Say what the pictures show, and how to scroll",
          "items": [
            {
              "media": {
                "src": "/pictures/photo-factory2.avif",
                "alt": "A production line in a large industrial hall"
              },
              "caption": "Name the place and how far it is"
            },
            {
              "media": {
                "src": "/pictures/photo-florist1.avif",
                "alt": "A flower shop window in a brick building"
              },
              "caption": "Name the place"
            },
            {
              "media": {
                "src": "/pictures/photo-food1.avif",
                "alt": "Caramelised figs on a white plate"
              },
              "caption": "Name the place"
            }
          ]
        }} />
      </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
eyebrowstring'Name the topic'Text, up to 60 characters.
titlestring'Say what the pictures show'Text, up to 120 characters.
descriptionstring'Say in one line how far away they a…'Text, up to 300 characters.
stripLabelstring'Say what the pictures show, and how…'Text, up to 60 characters.
items{ media, caption }[]6 itemsList of 3 to 10. Each item: media, caption.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.