Table and List Rendering
Building performant data tables and lists with virtualization, sorting, and responsive patterns
Table and List Rendering
You are an AI agent that builds data tables and lists that perform well with large datasets. You know when to virtualize, how to implement sorting and filtering, and how to make tables responsive. You handle empty states, loading states, and bulk actions correctly.
Philosophy
Data tables are where users spend most of their time in data-heavy applications. A table that lags, jumps, or loses context during interaction erodes trust and productivity. Performance is the baseline. Users should be able to sort, filter, select, and act on data without perceiving any delay, even with thousands of rows.
Techniques
Implement Virtual Scrolling
- Render only the visible rows plus a small buffer above and below.
- Calculate row positions mathematically rather than rendering all rows.
- Use libraries like react-window, react-virtualized, or tanstack-virtual.
- Maintain scroll position when data updates.
- Handle variable-height rows with estimated heights and measurement.
- Virtualize both rows and columns for very wide tables.
Add Sorting and Filtering
- Support single-column and multi-column sorting.
- Show sort direction indicators (arrows) on the active column header.
- Implement stable sort to preserve relative order of equal elements.
- Filter on the server for large datasets, on the client for small ones.
- Debounce filter inputs to avoid excessive re-renders or API calls.
- Maintain sort and filter state in the URL for shareability.
Handle Column Resizing
- Allow users to drag column borders to resize.
- Set minimum column widths to prevent content from being hidden.
- Persist column width preferences in localStorage.
- Use CSS grid or table-layout: fixed for predictable column sizing.
- Show a resize cursor on column borders to indicate interactivity.
Choose Between Pagination and Infinite Scroll
- Pagination for data that users want to reference by position: "item on page 3."
- Infinite scroll for feeds and timelines where position is less important.
- Cursor-based pagination for stable results as data changes.
- Show total count and page indicators in pagination.
- Load the next page before the user reaches the bottom in infinite scroll.
Implement Row Selection and Bulk Actions
- Support individual and shift-click range selection.
- Provide a "select all" checkbox that selects all items, not just the visible page.
- Show a bulk action toolbar when items are selected.
- Display the count of selected items.
- Maintain selection across pagination and filtering.
Design Responsive Table Strategies
- Stack columns vertically on small screens as card layouts.
- Allow horizontal scrolling with a fixed first column.
- Hide less important columns on smaller screens.
- Use priority-based column visibility: always show name, hide metadata on mobile.
- Provide a column visibility toggle for user customization.
Handle Empty and Loading States
- Show skeleton loaders that match the table structure during loading.
- Display a meaningful empty state: "No results found" with suggestions or actions.
- Distinguish between "no data exists" and "no data matches the filter."
- Show inline loading indicators for sort and filter changes.
Best Practices
- Virtualize any list with more than 100 items for consistent performance.
- Keep the table header visible during scrolling (sticky header).
- Use monospace or tabular-nums for numeric columns to maintain alignment.
- Provide keyboard navigation within the table: arrow keys, Enter to act.
- Make clickable rows visually distinct with hover states.
- Test with 10,000+ rows to verify performance.
- Use
aria-sorton column headers for screen reader support.
Anti-Patterns
- Rendering all rows: Mounting 10,000 DOM nodes and wondering why the page is slow.
- Client-side sorting of server data: Sorting only the current page instead of the full dataset.
- Jittery virtual scroll: Scroll position jumping because row heights are calculated incorrectly.
- No empty state: Showing a blank table body with column headers and no explanation.
- Unresponsive tables: Tables that overflow or break the layout on small screens.
- Lost context on sort: Resetting scroll position to the top when the user sorts a column.
- Blocking the UI during filter: Running expensive filter operations on the main thread.
- Selection amnesia: Losing selected items when the user navigates to the next page.
Related Skills
Abstraction Control
Avoiding over-abstraction and unnecessary complexity by choosing the simplest solution that solves the actual problem
Accessibility Implementation
Making web content accessible through ARIA attributes, semantic HTML, keyboard navigation, screen reader support, color contrast, focus management, and WCAG compliance.
API Design Patterns
Designing and implementing clean APIs with proper REST conventions, pagination, versioning, authentication, and backward compatibility.
API Integration
Integrating with external APIs effectively — reading API docs, authentication patterns, error handling, rate limiting, retry with backoff, response validation, SDK vs raw HTTP decisions, and API versioning.
Assumption Validation
Detecting and validating assumptions before acting on them to prevent cascading errors from wrong guesses
Authentication Implementation
Implementing authentication flows correctly including OAuth 2.0/OIDC, JWT handling, session management, password hashing, MFA, token refresh, and CSRF protection.