Dev.to AI 🤖 Ai 👁 0 📖 2 min read

Make the agent use the existing Table or DataGrid, not a handmade table of divs

The PR renders a list of records as a CSS grid of divs, or it builds a <table> with no caption, no column headers, and a clickable row that is not a link or a button. The repo already has a Table or DataGrid with headers

The PR renders a list of records as a CSS grid of divs, or it builds a <table> with no caption, no column headers, and a clickable row that is not a link or a button. The repo already has a Table or DataGrid with headers, a caption or aria-label, and the sort or selection pattern already wired. Nearby billing and member lists use it. The homemade grid is not announced as a table, and the header row is just bold text.

I've started treating a handmade table of divs as an incomplete data view, not as a lighter grid. Laying out columns is the easy part. Headers, a caption, and consistent row behavior are why the component is there.

Why the handmade grid shows up

A tutorial "responsive table" example is a stack of cards or a CSS grid of divs, because a real table is "hard to style." The model can write that without finding components/Table or DataGrid. Your component may wrap a design-system Table, or it may be named DataTable or ListTable, which is easy to miss if the prompt only says "show these rows."

You also skip column sort, row selection, empty states, and the rule about not using a table when the job is a true card list or a definition list.

A simple Table policy

  • New tabular data uses the existing Table or DataGrid
  • Do not lay out columns as a grid of divs in a feature file
  • Do not ship a table with no headers or caption
  • A new sort, selection, or density is a component change, with a story

If each item is a card with mixed actions and no consistent columns, that is the existing list or card component, not a fake table. If pagination is already a shared component, use it with the table instead of inventing a new pager.

What to put in the prompt

Use the existing Table or DataGrid for this set of records.
Do not lay out the columns as a grid of divs in this file.
Keep headers, the caption or label, and row behavior on the shared component.
If the content is a card list, use the existing list or card component instead.

Paste one existing Table or DataGrid usage. In review, search the diff for a CSS grid of row divs, a <table> with no <th>, and a clickable row that is not the existing row API.

Reject / send back

Reject

  • A feature-level data view that reimplements Table or DataGrid as divs
  • A table with no column headers or accessible name
  • A second grid or table library added for one list
  • A homemade pager next to a table when a pagination component already exists

Accept

  • A data view that uses the existing Table or DataGrid
  • A component PR that adds a documented sort, selection, or density and a story
  • A true card list that stays on the existing list or card component
📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.