Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Week Calendar

ProNew

A week as a grid of hours: events sized by length and set side by side where they overlap, a line at the current time, and slots you press to start an event.

Installation

pnpm dlx shadcn@latest add @viewport/week-calendar

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
days*{ label: string; date: number; today?: boolean }[]

The columns, in order. `date` is the day of the month.

—
events*CalendarEvent[]—
fromnumber

The first and last hour shown.

8
tonumber18
nownumber

The current time as an hour of the day, to draw the line across today.

—
onSelect(id: string) => void—
onCreate(day: number, start: number) => void

Called with a day and a start hour when an empty slot is pressed, or a day's add button.

—
selectedstring | null

The id of the selected event.

—
hourHeightnumber

The height of one hour, in pixels.

52
classNamestring—

Accessibility

  • Events are buttons named with their title, day and times.
  • Each day has an add button, so creating does not need a pointer.
  • Days keep a readable width and scroll sideways with the hours held in view.
  • Opens scrolled to today.
  • New events appear without the entrance under reduced motion.