Opening hours compact — Settings block

Pro

settings-opening-hours-compact · for app, settings pages

Opening hours compact

One card: the days as a row of chips that open or close them, then only the open days’ hours, the exceptions as short lines: a settings panel or an onboarding step where space is short

Documentation

Installation

One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).

pnpm dlx shadcn-vue@latest add @trame/settings-opening-hours-compact

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import SettingsOpeningHoursCompact from '@/components/trame/blocks/settings/settings-opening-hours-compact.vue'

const props = {
title: "Opening hours",
intro: "Shown on your shop page and used for click-and-collect times.",
week: [
{
day: "mon",
ranges: []
},
{
day: "tue",
ranges: [
{
from: "07:30",
to: "13:00"
},
{
from: "15:30",
to: "19:00"
}
]
}
],
exceptions: [
{
date: "2026-12-24",
label: "Christmas Eve",
ranges: [
{
from: "07:00",
to: "17:00"
}
]
},
{
date: "2026-12-25",
label: "Christmas Day",
ranges: []
}
],
timezone: "London time (GMT)",
accepting: {
label: "Accepting click-and-collect orders",
help: "Off: your page still shows the hours but takes no order.",
on: true
},
save: "hours.save",
options: {
saveLabel: "Save hours"
}
}
</script>

<template>
<SettingsOpeningHoursCompact v-bind="props" />
</template>

Props

Each prop says who changes it: Words, Picture, Action, Design, Data.* required.

PropTypeDescription
titlestringWordsthe panel’s heading, e.g. "Opening hours"
introstringWordsone sentence on where these hours show, e.g. "Shown on your shop page and used for bookings"
week*Week[]Datathe weekly hours as saved: one entry per day the merchant set; a day left out is closed
exceptionsException[]Datathe dated exceptions as saved, closed days and special hours, in date order
timezonestringWordsthe time zone the hours are in, in words, e.g. "London time (GMT)"
acceptingAcceptinga switch for taking new bookings or requests; absent, no switch
savestringActionsaves the hours: through the host it receives `{ week, exceptions, accepting? }`; posted natively the form carries `<day>.open`, `<day>.from` / `<day>.to` (repeated, in order), `ex<n>.date`, `ex<n>.label`, `ex<n>.open`, `ex<n>.from` / `ex<n>.to` and `accepting`. Absent, or when the page lacks it, the hours are shown read-only
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Week week[] · 2 props
PropTypeDescription
day*'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun'a day of the week: mon, tue, wed, thu, fri, sat or sun
ranges*Range[]the day’s opening ranges in order, a break being the gap between two; empty: closed that day
Range week[].ranges[] · 2 props
PropTypeDescription
from*stringDatawhen it opens, HH:mm on a 24-hour clock, e.g. "09:00"
to*stringDatawhen it closes, HH:mm; earlier than `from` when it closes after midnight, e.g. "02:00"
Exception exceptions[] · 3 props
PropTypeDescription
date*stringthe day, YYYY-MM-DD
labelstringWordswhy, e.g. "Bank holiday" or "Late opening"
ranges*Range[]the hours that day instead of the week’s; empty: closed
Range exceptions[].ranges[] · 2 props
PropTypeDescription
from*stringDatawhen it opens, HH:mm on a 24-hour clock, e.g. "09:00"
to*stringDatawhen it closes, HH:mm; earlier than `from` when it closes after midnight, e.g. "02:00"
Accepting accepting · 3 props
PropTypeDescription
label*stringWordswhat the switch turns on, e.g. "Accepting new bookings"
helpstringWordsone sentence on what it changes, e.g. "Off: your page shows the hours but takes no booking"
on*booleantrue: the switch is on now
Options options · 3 props
PropTypeDescription
firstDay'mon' | 'sun'the day the week starts on; Monday by default
saveLabelstringWordsthe save button, e.g. "Save hours"
mood'inverse' | 'brand' | 'warm' | 'tint' | stringa band of the page that redefines the theme surfaces inside it
What it asks your app for

The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).

MemberWhat it is for
hrefthe address an action leads to, or null to hide what leads there
actruns a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error }
canwhether the page has this action
cartCountthe cart badge’s number
cartDrawerwhether your app has a cart drawer
cartOpenwhether the cart drawer is open
labelyour word for an interface key, or undefined to keep the block’s own

The words it says itself, in English and French; label(key) replaces any of them:

KeyEnglishFrench
newsletter.alreadyYou are already subscribed.Vous êtes déjà inscrit.
newsletter.doneDone: you are subscribed.C’est noté : vous êtes inscrit.
newsletter.invalidCheck the email address.Vérifiez l’adresse e-mail.
newsletter.tooManyToo many attempts, try again in a moment.Trop de tentatives, réessayez dans un moment.

Features

  • Every word in the server HTML
  • Same markup in Vue and React
  • Theme tokens only: every theme, light and dark
  • Shows what you give it, invents nothing
  • No motion; still under reduced motion
  • Real buttons and links, a visible focus
  • Asks your app through actions: hours.save
  • Reads hours from your app

A settings section, for app, settings pages; it uses @lucide/vue, @vueuse/core, class-variance-authority, clsx, reka-ui, tailwind-merge.

Built with

The components this block is made of; each one installs on its own too.

More settings blocks

  • Layout single: one or two sections as a single long form with one save bar (a profile and an address).
  • Layout split rows: groups that save on their own: the title and its explanation beside the fields, one card per group.
  • Layout tabs: three to five sections that read as one page of an account (Account, Security, Notifications).
  • Notification preferences channel matrix: the same events sent on several channels (e-mail, SMS, push): one table, an event per row and a channel per column; on a phone, a card per event.
  • Notification preferences switch groups: notification choices as switches grouped by channel, each with the reason it exists.
  • Profile editor compact card: an account with few public fields: one narrow centred card, the portrait on top, a few fields and one full-width save button.
  • Profile editor cover header: a profile with a cover picture: a wide card with the cover and the portrait over its edge, each with its own button, the fields in cards under it.
  • Profile editor with preview: a creator, seller or member profile that others see: the form in cards, and beside it a card that repeats exactly what is typed.

All 38 settings blocks