Skip to content
New

Location, map

beta

The 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.
A map of the streets of Akwa, Douala, with a pin on the restaurant.
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

Installation

Terminal
npx rasengan-ui add location-map

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):

app/_routes/index.page.tsx
import { LocationMap } from "@/components/blocks/location-map";
import { home } from "@/content/home";
 
export default function Home() {
  return <LocationMap content={home.location} />;
}
content/home.ts
import { example, type LocationMapContent } from "@/components/blocks/location-map";
 
export const home = {
  location: {
    ...example,
    title: "Where we are",
  } satisfies LocationMapContent,
};

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

FieldTypeLimitsGuidance
titlestring2–48 chars'Find us', 'Where we are'.
addressobject
address.linesstring[]1–4 items
address.landmarkoptionalstring≤ 80 charsHow locals find it: 'opposite the central market'.
address.coordinatesoptionalobject
address.coordinates.latnumber-90–90
address.coordinates.lngnumber-180–180
address.mapUrloptionalstringuriA link to directions.
mapobjectA static picture of the map around the place, landscape. Its alt names the place and the area.
map.srcstringA local path ('/images/terrace.jpg') or the project's asset URL.
map.altstring≤ 140 charsWhat the image shows, for people who cannot see it. Empty only if purely decorative.
map.widthinteger
map.heightinteger
directionsobjectA link to directions in a maps app: 'Get directions'.
directions.labelstring1–32 charsA verb first, two to four words: 'Start free', 'Book a table'.
directions.hrefstringA path ('/pricing'), an anchor ('#menu'), or a full URL.
notesoptionalstring[]≤ 3 itemsPractical details: parking, the floor, the entrance, the nearest taxi stop.

Props

PropNotes
contentLocationMapContent; the example when left out
idthe section's id, for anchor links; "location" by default
headingLevel1, 2 or 3: the heading's tag; 2 by default
embedtrue for a live OpenStreetMap instead of the static picture, when address.coordinates is set; false by default
classNameon 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.