Skip to content
Klarhimmel UI

Report, figure

Report, figure previewReport, figure preview

Install

npx shadcn add @klarhimmel/report-figure
DetailsAbout, usage, props and more

A picture in a report, or a gallery of them, shown whole (never cropped, at most 90 % of the screen tall) with an optional title and captions, for decisions that need a…

Import

Import

import Block from '@/components/klarhimmel/blocks/report-figure';
Also called
  • report/figure
About
A picture in a report, or a gallery of them, shown whole (never cropped, at most 90 % of the screen tall) with an optional title and captions, for decisions that need a visual pick.
Category
A document for a reader: key figures, decisions with a recommended default, long-cell tables, timelines, callouts, sources and prose. Rendered to one HTML file by kh-report. New project? Set it up once: /get-started/installation.

Notes

When to use it

A picture inside a report, for a decision that needs a visual pick such as two layouts or two logos. For a table of numbers use report-table; for a boxed aside use report-callout.

Writing for it

- Write the alt text (300 characters) as what the pictures differ in, because the person choosing may not be able to see them. 'Version A on the left has a single column; version B on the right has a large heading' is more useful than 'Layout options'. - Put 'Figure 1' at the start of the caption (300 characters) when a decision card refers to the picture by number. Nothing links the two for you, so the number is the connection. - Set width to wide for screenshots with small text and leave it unset for diagrams that read fine at the reading width.

Watch out for

In kh-report the src is a local file path, turned into one embedded data address at build time. A web address is refused with an error and a file over 2 MB is refused naming the file, so shrink screenshots before you write the report.

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 ReportFigure from '@/components/klarhimmel/blocks/report-figure';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <ReportFigure props={{
          "title": "Name what is shown",
          "src": "/pictures/photo-party1.avif",
          "alt": "A party table with a cake and balloons",
          "caption": "Say what to look at in the picture, in a line",
          "width": "text"
        }} />
      </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
titlestring'Name what is shown'Text, up to 80 characters.
srcstring'/pictures/photo-party1.avif'Text, up to 3000000 characters.
altstring'A party table with a cake and ballo…'Text, up to 300 characters.
captionstring'Say what to look at in the picture,…'Text, up to 300 characters.
width'text' | 'wide''text'One of 'text', 'wide'. Optional; empty is not rendered.
images{ src, alt, caption, wide }[]-List of up to 12. Each item: src, alt, caption, wide (optional). Optional; empty is not rendered.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.