Skip to content
Klarhimmel UI

Error, with links

Error, with links previewError, with links preview

Install

npx shadcn add @klarhimmel/error-links
DetailsAbout, usage, props and more

A not-found or error page that does not leave people stranded: code, plain explanation, one primary action, and a short list of described places to go next.

Import

Import

import Block from '@/components/klarhimmel/blocks/error-links';
Also called
  • error/links
About
A not-found or error page that does not leave people stranded: code, plain explanation, one primary action, and a short list of described places to go next. Left-aligned, two columns when wide.
Category
Not found, server error and maintenance pages. New project? Set it up once: /get-started/installation.

Notes

When to use it

A not-found page that offers a primary action and a described list of places to go next. When two buttons are enough use error-page.

Writing for it

- The code holds 20 characters and prints large, so 404 works well. The title is the page h1 at 100 characters. - Links need 1 to 5 entries with a label of 60 characters and a description of 120. Describe what the reader gets at the target, not just its name. - The links title holds 60 characters and the description 300. Say what likely went wrong, without blaming the reader.

Watch out for

The page title is an h1 and the link list title is an h2, so do not also place an h1 in the navbar of the same page. Each link row is a single clickable area and long labels wrap.

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 ErrorLinks from '@/components/klarhimmel/blocks/error-links';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <ErrorLinks props={{
          "code": "404",
          "title": "Say what went wrong in plain words",
          "description": "Say in two sentences what likely happened and that nothing is wrong on their side, then point to the pages below.",
          "primary": {
            "label": "Main action",
            "href": "/"
          },
          "linksTitle": "Name the pages below",
          "links": [
            {
              "label": "First page",
              "description": "Say what they find there, in a line",
              "href": "/rooms"
            },
            {
              "label": "Second page",
              "description": "Say what they find there, in a line",
              "href": "/book"
            },
            {
              "label": "Third page",
              "description": "Say what they find there, in a line",
              "href": "/directions"
            },
            {
              "label": "Fourth page",
              "description": "Say what they find there, in a line",
              "href": "/contact"
            }
          ]
        }} />
      </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
codestring'404'Text, up to 20 characters.
titlestring'Say what went wrong in plain words'Text, up to 100 characters.
descriptionstring'Say in two sentences what likely ha…'Text, up to 300 characters.
primaryLink{…}See the type.
linksTitlestring'Name the pages below'Text, up to 60 characters.
links{ label, description, href }[]4 itemsList of 1 to 5. Each item: label, description, href.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.