Composants
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.
import { OpeningHours } from "@krizaka/ui/opening-hours";Web uniquement — React, depuis @krizaka/ui/opening-hours. Bêta : son API peut encore changer à une version mineure.
- Mobile · n/a. A shop's public storefront is a web page. → List
Pourquoi il est là. Used by Akinaza.
Quand l’utiliser
- A shop's page or a place's card: when it is open now, and the week for whoever wants it.
Quand ne pas l’utiliser
- Hours as data to sort or edit.À la place : Data table
- A few facts of an object.À la place : Description list
Installation
Installer
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Importer
import { OpeningHours } from "@krizaka/ui/opening-hours";Exemples
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.
| Prop | Type | Défaut | Description |
|---|---|---|---|
daysrequis | readonly OpeningDay[] | — | The week, in reading order. |
labelrequis | string | — | The name of the list (Hours), passed translated. |
statusrequis | OpeningStatus | — | Open or closed right now, in words. |
today | string | — | The id of today's day: its row is marked (aria-current="date") and its hours show on the closed row. |
Accessibilité
- A native
details: the summary is the one control, named by the status, the detail andlabel. - Today's row is
aria-current="date"; the status dot is decorative, the words say open or closed.
Clavier
| Touches | Action |
|---|---|
| Enter or Space | Unfolds or folds the week (a native disclosure). |
Bonnes pratiques
- Compute
statusfrom 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.
Composants liés
Générée depuis le code de @krizaka/ui 3.63.1 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub