Skip to content

Block 169 of 297

Amenity Matrix

Find a park by amenity: a parks-by-amenities table with check marks and a sticky park column that scrolls on phones.

Puck key
AmenityMatrixBlock
Export
amenityMatrixBlock
React component
<AmenityMatrix />
Path
components/puck/amenity-matrix-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 comparison table with parks down the left, amenities across the top and a check mark wherever a park has that amenity. The park column stays pinned while the rest of the table scrolls sideways on phones, and each park row shows a running count such as "4 of 9". Use it when visitors are choosing a park by what it has rather than where it is.

  • A "Find a park by amenity" page for a park district
  • A comparison of community centers by features
  • A planning document page showing amenity coverage across parks
Writing the content
  • Type Amenity columns as a comma-separated list; each item becomes a column in the order you write it.
  • In Amenities it has, spell each amenity exactly as in the column list. Capitals and extra spaces are ignored, but typos leave the cell empty.
  • Up to 60 parks fit. Use Footnote for seasonal exceptions, like restrooms that close in winter.
Accessibility
  • It is a real table with column headers and the park name as each row header, plus a hidden caption that states how many parks are listed (WCAG 1.3.1).
  • Every cell has hidden "Yes" or "No" text, so availability is not conveyed by the check icon alone (WCAG 1.1.1).
  • The scrolling area is a focusable region named by the caption, so keyboard users can scroll it (WCAG 2.1.1).
Customizing the code
  • The check circle is bg-indigo-700 and row hover is bg-indigo-50; change both in the td and th classNames.
  • Column widths come from min-w-24 on amenity headers and min-w-40 sm:min-w-56 on the park column.

Editor fields

What content editors see in the P1 sidebar when they select this block.

  • Headingtext
  • Heading levelselect
  • Introtextarea
  • Amenity columnstextarea
  • Parksarray
  • Footnotetextarea
  • Link texttext
  • Linktext