Availability Grid
ProNewSet 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
| Prop | Type | Default |
|---|---|---|
| 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 | — |
| from | numberThe first and last hour offered. | 8 |
| to | number | 18 |
| step | 30 | 60The length of a slot, in minutes. | 60 |
| className | string | — |
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.