Block 172 of 297
Availability Grid
A weekly table of fields, courts and rooms showing Open, Booked or Closed each day, with opt-in status colors.
- Puck key
- AvailabilityGridBlock
- Export
- availabilityGridBlock
- React component
- <AvailabilityGrid />
- Path
- components/puck/availability-grid-block.tsx
- Dependencies
- None
- License
- MIT
About this block
When to use it, how to write for it, and what to change in the code.
What it's for
A one-week booking grid with facilities down the side, days across the top and a status word in every cell, such as Open, Partly booked, Booked or Closed. The facility column stays pinned while the days scroll sideways on phones. Week navigation, a status key and a booking button frame the table. Use it when residents need to see open slots before they reserve.
- Field and court availability for a parks department
- Community center room availability for the coming week
- Shelter reservations during peak picnic season
Writing the content
- List Day columns separated by commas, like "Mon Oct 12, Tue Oct 13"; the first word of each shows larger.
- In Status by day, separate statuses with | in the same order as the days. Words like "Reserved" or "Maintenance" are matched to Booked or Closed styling, and other words show as written.
- Status colors is off by default, which uses indigo and gray only; turn it on for green, amber and red. Up to 30 facilities fit.
Accessibility
- Every status shows its word and an icon, and blank cells read "No information", so color is never the only cue even with Status colors on (WCAG 1.4.1).
- The grid is a real table with day and facility headers and a hidden caption built from the heading and week (WCAG 1.3.1).
Customizing the code
- Status matching is in the kindOf function; add words to its regular expressions to map local terms.
- Cell styles live in neutralStyles and colorStyles; adjust either palette without touching the markup.
Editor fields
What content editors see in the P1 sidebar when they select this block.
- Headingtext
- Heading levelselect
- Introtextarea
- Weektext
- Day columnstext
- Facilitiesarray
- Status colorsradio
- Updated notetext
- Booking button texttext
- Booking linktext
- Previous week linktext
- Next week linktext