Hours, week
betaThe week's opening hours, one or more slots a day, today highlighted and a live 'open now' in the business's time zone.
npx rasengan-ui add hours-week
Opening hours
- Monday
- Closed
- Tuesday
- 11:30 – 15:0018:30 – 23:00
- Wednesday
- 11:30 – 15:0018:30 – 23:00
- Thursday
- 11:30 – 15:0018:30 – 23:00
- Friday
- 11:30 – 0:30
- Saturday
- 11:30 – 0:30
- Sunday
- 12:00 – 17:00
Closed on 1 January and 20 May. The kitchen takes its last orders 30 minutes before closing.
- Use it
- Any place people visit: restaurants, shops, salons, clinics.
- Avoid it
- Hours by appointment only: say so in a contact block.
- Built with
- Badge
- Pairs with
- Location, mapContact, links
Installation
It installs into components/blocks/hours-week/, with what it uses (Badge) 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):
Slots that close after midnight ({ open: "18:30", close: "00:30" }) count for the next day too. "Open now" and today's highlight use timeZone, the business's, not the visitor's; they appear once the page has read the clock, so the prerendered HTML and the hydrated page agree.
Content
| Field | Type | Limits | Guidance |
|---|---|---|---|
title | string | 2–48 chars | 'Opening hours', 'When to find us'. |
hours | object | ||
hours.days | object[] | 1–7 items | |
hours.days[].day | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday" | ||
hours.days[].slots | object[] | ≤ 3 items | Empty for a closed day. |
hours.days[].slots[].open | string | 24-hour 'HH:MM'. | |
hours.days[].slots[].close | string | 24-hour 'HH:MM'. | |
hours.noteoptional | string | ≤ 120 chars | Holidays, exceptions. |
timeZone | string | ≥ 3 chars | The business's IANA time zone, for 'open now': 'Africa/Douala'. |
localeoptional | string | A BCP 47 locale for day names and times ('en-CM'); the page's language when left out. | |
labels | object | Shown by day and by the live status, which appears once the page has read the clock. | |
labels.closed | string | 1–24 chars | 'Closed' |
labels.today | string | 1–16 chars | 'Today' |
labels.openNow | string | 1–24 chars | 'Open now' |
labels.closedNow | string | 1–24 chars | 'Closed now' |
Props
| Prop | Notes |
|---|---|
content | HoursWeekContent; the example when left out |
id | the section's id, for anchor links; "hours" by default |
headingLevel | 1, 2 or 3: the heading's tag; 2 by default |
className | on the <section>, for spacing |
Accessibility
- The week is a description list: each day (
dt) with its slots (dd). - Day names and times follow
locale.