Skip to content

Conversation

@masoudmanson
Copy link
Contributor

@masoudmanson masoudmanson commented Jul 31, 2025

Summary

PreComposedTable

Github issue: https://czi.atlassian.net/browse/SCIDS-1003?atlOrigin=eyJpIjoiYzAyODU1YTY4ZjA0NDJhYzk5MWQ2Mzc1NTA2NjZkODIiLCJwIjoiaiJ9

This PR adds a new PreComposedTable component; a fully-featured, composable table built on top of TanStack Table.

  • Added PreComposedTable with built-in support for sorting, pagination, row selection, filtering, column pinning, and responsive sizing
  • Updated CellBasic, CellHeader, and CellComponent with new props and better styling flexibility
  • Added Storybook examples and updated tests to cover new functionality
  • Switched to Yarn and added a ResizeObserver mock for Jest tests
  • No breaking changes; everything is additive and backward-compatible

Component Props

Name Type Default Description
data TData[] Array of data objects to display in the table rows
columns ColumnDef<TData>[] Column definitions that specify how data should be rendered and behave
enableSorting boolean false Enables sorting functionality for table columns
enableRowSelection boolean false Adds checkboxes for row selection with select-all functionality
shouldPinSelectRowToLeft boolean true Pins the row selection column to the left/right side of the table
enablePagination boolean false Enables pagination controls at the bottom of the table
enableGlobalFiltering boolean false Displays a search input that filters across all columns
paginationConfig Partial<PaginationProps> & { placement?: "left" | "center" | "right" } Config object for pagination settings including placement and page size
className string CSS class name to apply to the table container
style React.CSSProperties Inline styles to apply to the table container
tableWidth string "100%" Sets the width of the table container
tableRowProps Partial<TableRowProps> Additional props to pass to each table row component
onRowSelect (selectedRows: TData[]) => void Callback triggered when row selection changes; receives array of selected row data

Default Table:

Screenshot 2025-07-31 at 3 58 35 PM

Row hover state with underline effect:

Screenshot 2025-07-31 at 3 58 57 PM

Column Sorting:

Screenshot 2025-07-31 at 4 00 27 PM

Row Selection:

Screenshot 2025-07-31 at 3 59 14 PM

Pagination:

Screenshot 2025-07-31 at 3 59 38 PM

Global Filtering:

Screenshot 2025-07-31 at 4 01 45 PM

Column Pinning:

Jul-31-2025 16-07-19

Checklist

  • Default Story in Storybook
  • Test Story in Storybook
  • Tests written
  • Semantic Variables from defaultTheme.ts used wherever possible
  • If updating an existing component, depreciate flag has been used where necessary
  • ZeroHeight Documents updated
  • Chromatic build verified by @chanzuckerberg/sds-design

@masoudmanson masoudmanson self-assigned this Jul 31, 2025
@masoudmanson masoudmanson added the Ready for review This PR is ready for review label Jul 31, 2025
Copy link

@clarsen-czi clarsen-czi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few small tweaks and confirmation of a change I might not be able to visually see in Storybook, but otherwise looks great! Thanks @masoudmanson !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for review This PR is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants