Krizaka UI
Krizaka UI
Components

Opening hours

A shop's weekly hours in one quiet row — « Open now · closes at 5 pm » and today's hours — that unfolds into the whole week, today highlighted.

Web · ✓Mobile · n/aDesktop · ✓BetaData display
import { OpeningHours } from "@krizaka/ui/opening-hours";

Web only — React, from @krizaka/ui/opening-hours. Beta: its API may still change in a minor version.

  • Mobile · n/a. A shop's public storefront is a web page. → List

Why it is here. Used by Akinaza.

When to use

  • A shop's page or a place's card: when it is open now, and the week for whoever wants it.

When not to use

Installation

Install

npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcss

Styles

@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";

Import

import { OpeningHours } from "@krizaka/ui/opening-hours";

Examples

Week

Open now, closing at 5 pm, with the week unfolded and Tuesday marked.

Props

The weekly hours in one row — open now, closes at… — that unfolds into the week, today highlighted.

PropTypeDefaultDescription
daysrequiredreadonly OpeningDay[]—The week, in reading order.
labelrequiredstring—The name of the list (Hours), passed translated.
statusrequiredOpeningStatus—Open or closed right now, in words.
todaystring—The id of today's day: its row is marked (aria-current="date") and its hours show on the closed row.

Accessibility

  • A native details: the summary is the one control, named by the status, the detail and label.
  • Today's row is aria-current="date"; the status dot is decorative, the words say open or closed.

Keyboard

KeysAction
Enter or SpaceUnfolds or folds the week (a native disclosure).

Best practices

  • Compute status from the hours, the shop's time zone and the current time on the server; the block only lays it out.
  • Pass each day's hours already formatted, with your word for closed when there are none (Closed).
  • Name today (today) so its row is marked; the closed row then shows today's hours on a wide screen.
  • Keep the row collapsed on a phone: the week is one tap away.

Generated from the code of @krizaka/ui 3.63.1: its meta.ts, its examples and its types.Edit this documentation on GitHub

On this page