Location, map
betaThe address with how locals find it, a directions link and practical notes beside a static map; an OpenStreetMap embed on request.
npx rasengan-ui add location-map
Find us
Rue Joss, AkwaDouala, CameroonTwo streets from the Akwa post office, the green door.Get directions- Parking on the street in the evening.
- Taxis stop at the Akwa roundabout, two minutes away.
- Use it
- Any place people come to, especially where street addresses are not enough.
- Avoid it
- An online-only business, or a home address that should stay private.
- Built with
- Button
- Pairs with
- Hours, weekContact, links
Installation
It installs into components/blocks/location-map/, with what it uses (Button) and lib/blocks.ts.
Usage
Without content, the block shows its example. Pass your own, typed by the block's schema, from a content file (here, the example with one field changed):
By default the map is the content's static picture, linking to the full map, so the page loads nothing from a third party. embed swaps it for a live OpenStreetMap when the address has coordinates: <LocationMap embed />. Mention it in the site's privacy policy.
Content
| Field | Type | Limits | Guidance |
|---|---|---|---|
title | string | 2–48 chars | 'Find us', 'Where we are'. |
address | object | ||
address.lines | string[] | 1–4 items | |
address.landmarkoptional | string | ≤ 80 chars | How locals find it: 'opposite the central market'. |
address.coordinatesoptional | object | ||
address.coordinates.lat | number | -90–90 | |
address.coordinates.lng | number | -180–180 | |
address.mapUrloptional | string | uri | A link to directions. |
map | object | A static picture of the map around the place, landscape. Its alt names the place and the area. | |
map.src | string | A local path ('/images/terrace.jpg') or the project's asset URL. | |
map.alt | string | ≤ 140 chars | What the image shows, for people who cannot see it. Empty only if purely decorative. |
map.width | integer | ||
map.height | integer | ||
directions | object | A link to directions in a maps app: 'Get directions'. | |
directions.label | string | 1–32 chars | A verb first, two to four words: 'Start free', 'Book a table'. |
directions.href | string | A path ('/pricing'), an anchor ('#menu'), or a full URL. | |
notesoptional | string[] | ≤ 3 items | Practical details: parking, the floor, the entrance, the nearest taxi stop. |
Props
| Prop | Notes |
|---|---|
content | LocationMapContent; the example when left out |
id | the section's id, for anchor links; "location" by default |
headingLevel | 1, 2 or 3: the heading's tag; 2 by default |
embed | true for a live OpenStreetMap instead of the static picture, when address.coordinates is set; false by default |
className | on the <section>, for spacing |
Accessibility
- The address is an
<address>; the landmark says how locals find the place. - The live map's frame is named by the map's
alt.