Business Hours
ProNewOpening hours with a live Open or Closed status worked out in the business's timezone, from a one-line status to a full contact card.
Installation
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
Props
| Prop | Type | Default |
|---|---|---|
| hours* | WeekHoursOpening periods for each day, Sunday first. | — |
| timezone | stringIANA timezone of the business, such as `America/New_York`. Defaults to the visitor's own. | — |
| exceptions | HoursException[]Holiday and one-off hours, replacing the week on their date. | — |
| layout | "hours" | "compact" | "contacts" | "card" | "full"`hours` is the status and the week; `compact` folds the week behind the status; `contacts` adds labelled contact rows; `card` and `full` add the photo, name and actions. | "hours" |
| name | string | — |
| description | string | — |
| photo | stringCover photo for the `card` and `full` layouts. | — |
| logo | stringSquare logo shown above the name in the `full` layout. | — |
| phone | string | — |
| address | string | — |
| addressHref | stringMakes the address a link, for example to a map. | — |
string | — | |
| website | string | — |
| actions | BusinessAction[]Buttons under the name in the `card` and `full` layouts. | [] |
| weekStart | 0 | 1First day of the week: `0` for Sunday, `1` for Monday. | 0 |
| hour12 | boolean12-hour times with AM and PM. Turn off for 24-hour times. | true |
| soon | numberMinutes before closing when the status turns to "Closing soon". | 30 |
| defaultOpen | booleanStarts the folded week open in the `compact`, `contacts` and `card` layouts. | false |
| now | DateFixes the clock, for tests and screenshots. Defaults to the real time, checked every few seconds. | — |
| className | string | — |
Accessibility
- The week is a real table with a caption; today's row is marked as the current date and reads “Today, Friday”.
- The status is a live region, so “Closing soon” and “Closed” are announced when the time comes.
- In the folded layouts the status is a button that says whether the week is expanded.
- Phone, email and address are real links. The week unfolds without animation under reduced motion.