Week Strip

Days in a row that move a week at a time.

Source
$npx @dinachi/cli@latest add week-strip
TodayThursday 19 November
  • Haircut with Ada
counts
disabled

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} />;
}

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
agent
Date
Controlled day. Defaults to today.
defaultValueDate
Starting day when uncontrolled.
onValueChange
agent
(value, details) => void
Runs on every pick, for people and agents. details.cancel() refuses the change.
min
agent
Date = Start of last week
The first day in the strip.
max
agent
Date = End of the third week ahead
The last day in the strip.
countsRecord<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
agent
boolean = false
Blocks people and agents.
namestring
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

label

The aria-label, "Day" by default.

value

The 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 counts is 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.