Skip to content
Klarhimmel UI

Contact, address and map

Contact, address and map previewContact, address and map preview

Install

npx shadcn add @klarhimmel/contact-map
DetailsAbout, usage, props and more

A visit page in two halves: the address, an opening-hours list, phone and email on one side, a map image with a directions link on the other.

Import

Import

import Block from '@/components/klarhimmel/blocks/contact-map';
Also called
  • contact/map
About
A visit page in two halves: the address, an opening-hours list, phone and email on one side, a map image with a directions link on the other. For a shop, studio or restaurant that people come to.
Category
A form, a booking panel or office details. The page wires the submit. New project? Set it up once: /get-started/installation.

Notes

When to use it

A visit page in two halves: address, opening hours, phone and email on one side, a map image with a directions link on the other. For several locations, contact-offices is the better fit.

Writing for it

- Hours need two to seven rows with a day (30, required) and a time (40). An empty time leaves a day with nothing next to it, which is how you show 'Closed' only if you write it. - The address (160) keeps its line breaks, so write it as street on one line and postcode and city on the next. - The map is a picture, not an embed. Use a static screenshot with a visible pin, and put the live route in the directions link.

Watch out for

Phone numbers are turned into tel links by stripping everything but digits and plus, so write them in a form that leaves a valid number. Address, phone, email and the directions link each vanish when empty. With no map picture the hours take the map's half and the directions link sits under the contact lines, so a page built from words alone shows no empty box.

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 ContactMap from '@/components/klarhimmel/blocks/contact-map';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <ContactMap props={{
          "eyebrow": "Name a topic",
          "title": "Invite them to visit",
          "address": "Give the street address\nGive the town",
          "hoursTitle": "Name the hours",
          "hours": [
            {
              "day": "Name the days",
              "time": "00:00 to 00:00"
            },
            {
              "day": "Name the days",
              "time": "00:00 to 00:00"
            },
            {
              "day": "Name the day",
              "time": "Closed"
            }
          ],
          "phone": "+00 00 000 00 00",
          "email": "you@company.example",
          "directions": {
            "label": "Main action",
            "href": "#directions"
          },
          "map": {
            "src": "/pictures/map-4.svg",
            "alt": "A street map with a pin",
            "srcDark": "/pictures/map-4-dark.svg"
          }
        }} />
      </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 a topic'Text, up to 60 characters.
titlestring'Invite them to visit'Text, up to 120 characters.
descriptionstring-Text, up to 800 characters. Optional; empty is not rendered.
addressstring'Give the street address Give the to…'Text, up to 160 characters. Optional; empty is not rendered.
hoursTitlestring'Name the hours'Text, up to 40 characters. Optional; empty is not rendered.
hours{ day, time }[]3 itemsList of up to 10. Each item: day, time.
phonestring'+00 00 000 00 00'Text, up to 40 characters.
emailstring'you@company.example'Text, up to 80 characters.
directionsLink{…}See the type.
buttonsLink[]-List of up to 2. Optional; empty is not rendered.
mapMedia{…}See the type.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.