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

Availability Grid

ProNew

Set bookable hours for a week: press a slot or drag across several to paint them, with each day's open hours read back in words.

Installation

pnpm dlx shadcn@latest add @viewport/availability-grid

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*string[]

The rows, in order, e.g. the days of the week.

—
value*Record<string, boolean[]>

Which slots are open on each day, by day. Every row has `(to - from) * 60 / step` slots.

—
onValueChange*(value: Record<string, boolean[]>) => void—
fromnumber

The first and last hour offered.

8
tonumber18
step30 | 60

The length of a slot, in minutes.

60
classNamestring—

Accessibility

  • A grid with one Tab stop: arrow keys move, Space or Enter toggles.
  • Each slot is named with its day, its times and whether it is open.
  • The day's hours are written out, so the grid is not the only source.
  • Vertical scrolling still works on touch while painting sideways.