Skip to content

[Feature Request]: Add Total Row functionality to Table Component #3803

@srp-tom

Description

@srp-tom

Description

In our ERP application, we frequently need to display aggregated data (e.g., sum, average, count) at the bottom of a table. Currently, the Table component in Cloudscape does not provide a built-in way to render a total row.
Developers need to manually append a custom row outside of the component, which makes styling and alignment inconsistent with the rest of the table.

It would be helpful if the Table component supported a Total Row (Footer Row) feature, similar to how many enterprise data grid libraries provide summary rows.

  • Option to enable a footer row.
  • Ability to define aggregations (sum, average, min, max, custom).
  • Consistent styling with table cells, aligned with columns.
  • Sticky footer option, similar to sticky header.

Example

<Table
  header={<Header>Purchase Orders</Header>}
  columnDefinitions={[
    { id: 'item', header: 'Item', cell: item => item.name },
    { id: 'qty', header: 'Quantity', cell: item => item.qty },
    { id: 'price', header: 'Price', cell: item => item.price },
  ]}
  items={[
    { name: 'Fabric A', qty: 10, price: 200 },
    { name: 'Fabric B', qty: 5, price: 100 },
  ]}
  totalRow={{
    cells: {
      item: 'Total',
      qty: (items) => items.reduce((sum, i) => sum + i.qty, 0),
      price: (items) => items.reduce((sum, i) => sum + i.price, 0),
    },
    sticky: true
  }}
/>

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions