Skip to content
New

Location, branches

beta

One card per branch: a map or a photo, the address and a landmark, today's hours and open now, and call and directions links.

npx rasengan-ui add location-branches

Find us

Two kitchens, the same recipes. Both deliver in their part of town.

Use it
A business with two to six places: a restaurant group, a chain of salons, shops in several districts.
Avoid it
One place: location-map shows it larger, with an optional embedded map.
Built with
BadgeButton

Installation

Terminal
npx rasengan-ui add location-branches

It installs into components/blocks/location-branches/, with what it uses (Badge, 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 { LocationBranches } from "@/components/blocks/location-branches";
import { home } from "@/content/home";
 
export default function Home() {
  return <LocationBranches content={home.locations} />;
}
content/home.ts
import { example, type LocationBranchesContent } from "@/components/blocks/location-branches";
 
export const home = {
  locations: { ...example, title: "Our restaurants" } satisfies LocationBranchesContent,
};

Give each branch its openingHours to show today's hours and an "open now" badge, read in timeZone (the business's, not the visitor's) once the page has loaded. A branch without hours shows its address and links only.

Content

FieldTypeLimitsGuidance
titlestring2–48 chars'Find us', 'Our shops'.
sublineoptionalstring≤ 160 chars
branchesobject[]2–6 itemsOne card each. With opening hours, a card says today's hours and whether it is open now.
branches[].namestring1–48 charsWhich one: 'Akwa', 'Bonamoussadi'.
branches[].addressobject
branches[].address.linesstring[]1–4 items
branches[].address.landmarkoptionalstring≤ 80 charsHow locals find it: 'opposite the central market'.
branches[].address.coordinatesoptionalobject
branches[].address.coordinates.latnumber-90–90
branches[].address.coordinates.lngnumber-180–180
branches[].address.mapUrloptionalstringuriA link to directions.
branches[].openingHoursoptionalobject
branches[].openingHours.daysobject[]1–7 items
branches[].openingHours.days[].day"monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday"
branches[].openingHours.days[].slotsobject[]≤ 3 itemsEmpty for a closed day.
branches[].openingHours.days[].slots[].openstring24-hour 'HH:MM'.
branches[].openingHours.days[].slots[].closestring24-hour 'HH:MM'.
branches[].openingHours.noteoptionalstring≤ 120 charsHolidays, exceptions.
branches[].phoneoptionalstring≤ 24 charsIn international form: '+237 6 99 00 00 00'.
branches[].imageoptionalobjectA static map or a photo of the front.
branches[].image.srcstringA local path ('/images/terrace.jpg') or the project's asset URL.
branches[].image.altstring≤ 140 charsWhat the image shows, for people who cannot see it. Empty only if purely decorative.
branches[].image.widthinteger
branches[].image.heightinteger
timeZonestring≥ 3 charsThe business's IANA time zone, for 'open now': 'Africa/Douala'.
localeoptionalstringA BCP 47 locale for times ('en-CM'); the page's language when left out.
labelsobjectToday's line and the badge appear once the page has read the clock.
labels.todaystring1–16 chars'Today'
labels.closedTodaystring1–24 chars'Closed today'
labels.openNowstring1–24 chars'Open now'
labels.closedNowstring1–24 chars'Closed now'
labels.directionsstring1–24 chars'Directions'
labels.callstring1–16 chars'Call'

Props

PropNotes
contentLocationBranchesContent; the example when left out
idthe section's id, for anchor links; "locations" by default
headingLevel1, 2 or 3: the heading's tag; 2 by default
classNameon the <section>, for spacing

Accessibility

  • The address is an address element.
  • The phone number is written on the call button.