$npx @dinachi/cli@latest add week-strip
TodayThursday 19 November
- Haircut with Ada
countsdisabledbookings.tsx
import { useState } from "react"
import { WeekStrip } from "@/components/ui/week-strip"
export function Bookings({ counts }: { counts: Record<string, number> }) {
const [day, setDay] = useState(new Date())
return (
<WeekStrip
aria-label="Bookings"
counts={counts}
formatCount={(n) => `${n} ${n === 1 ? "booking" : "bookings"}`}
value={day}
onValueChange={setDay}
>
<Agenda day={day} />
</WeekStrip>
)
}Usage
import { useState } from "react"
import { WeekStrip } from "@/components/ui/week-strip"
export function Schedule() {
const [day, setDay] = useState(new Date())
return (
<WeekStrip aria-label="Schedule" value={day} onValueChange={setDay} counts={{ "2026-11-18": 3 }}>
<Agenda day={day} />
</WeekStrip>
)
}Examples
TodayThursday 19 November
Last week to three weeks ahead, today selected.
import { useState } from 'react';
import { startOfDay } from '@/components/ui/calendar';
import { WeekStrip } from '@/components/ui/week-strip';
export function Example() {
const [day, setDay] = useState(() => startOfDay(new Date()));
return <WeekStrip aria-label="Schedule" className="max-w-xl" value={day} onValueChange={setDay} />;
}TodayThursday 19 November
- Haircut with Ada
Dots for each day's bookings, and the day's list under the strip.
import { useState } from 'react';
import { startOfDay, toISODate } from '@/components/ui/calendar';
import { WeekStrip } from '@/components/ui/week-strip';
export function Example({ bookings }: { bookings: Record<string, string[]> }) {
const [day, setDay] = useState(() => startOfDay(new Date()));
const counts = Object.fromEntries(Object.entries(bookings).map(([k, v]) => [k, v.length]));
const list = bookings[toISODate(day)] ?? [];
return (
<WeekStrip
aria-label="Bookings"
className="max-w-xl"
value={day}
onValueChange={setDay}
counts={counts}
formatCount={(n) => `${n} ${n === 1 ? "booking" : "bookings"}`}
>
<ul className="grid gap-1 px-[1.125rem] pt-2 text-sm">
{list.length ? list.map((v) => <li key={v}>{v}</li>) : <li className="text-muted-foreground">No bookings</li>}
</ul>
</WeekStrip>
);
}Notes
Server rendering
Pass today when the page renders on a server, so the server and the browser agree on which day it is.
Phone and desktop
Below 768px the title is the screen's own: large, and Today when it is.
Long ranges
Only the eight weeks either side of the selected one render, and more join as the strip scrolls toward an end, so a range of a year or more stays light.
API
value
Controlled day. Defaults to today.agent
DatedefaultValueDate
Starting day when uncontrolled.onValueChange
Runs on every pick, for people and agents. agent
(value, details) => voiddetails.cancel() refuses the change.min
The first day in the strip.agent
Date = Start of last weekmax
The last day in the strip.agent
Date = End of the third week aheadcountsRecord<string, number>
How busy each day is, keyed YYYY-MM-DD. Up to three dots show under the date.thresholds[number, number, number]
Counts at or above each step get one more dot. Defaults to one dot per count, up to three.formatCount(count: number) => string = "2 events"
How a day's count reads to screen readers.localeLocale
A date-fns locale for day names and the first day of the week.weekStartsOn0 to 6 = 1
The first day of the week, 0 for Sunday. Defaults to the locale's.dir"ltr" | "rtl"
Reading direction. Arrow keys follow it.todayDate
Overrides the current day.disabled
Blocks people and agents.agent
boolean = falsenamestring
Submits the day as YYYY-MM-DD.childrenReactNode
The content under the strip, for the selected day.Agent
Inside an AgentProvider, it appears in agent.snapshot() as date.
Reads
labelThe aria-label, "Day" by default.
valueThe selected day as YYYY-MM-DD.
Actions
setValue("2026-11-20")Selects a day. Phrases such as "next fri" work too.
An agent's change runs through onValueChange like anyone's. isAgentChange(details) is true for it; details.cancel() refuses it. A day off the strip is refused with its first or last day.
await agent.act({
steps: [{ ref: "Schedule", action: "setValue", args: ["next fri"] }],
})Accessibility
- The days are a horizontal listbox; the selected day has aria-selected and is the only one in the tab order.
- Each day is named in full, with its count when
countsis given, such as Wednesday 18 November, 3 events. Days in another year than today's carry the year, and so does the title. - The title is a live region, so the selected day is announced as it changes.
Keyboard
←→Selects the day before or after
PageUpPageDownSelects the same day a week before or after, or the first or last day when less than a week is left
HomeGoes back to today
EndGoes to the last day
←→Selects the day before or after
PageUpPageDownSelects the same day a week before or after, or the first or last day when less than a week is left
HomeGoes back to today
EndGoes to the last day