Skip to content

Table

Used to display data in a tabular format.

Shopping Cart
#ProductQuantityPriceTotal
1Product 11100100
2Product 22200400
3Product 33300900
Total61500
import { Table } from '@fintech-sandpit/ui/react';
return (
<div className="max-w-[50%] max-h-[200px] overflow-auto whitespace-nowrap pr-1 pb-1">
<Table.Root
showRowStripe
showColumnBorder
>
<Table.Caption>
Shopping Cart
</Table.Caption>
<Table.Header sticky>
<Table.Row>
<Table.ColumnHeader sticky="5rem">#</Table.ColumnHeader>
<Table.ColumnHeader>Product</Table.ColumnHeader>
<Table.ColumnHeader>Quantity</Table.ColumnHeader>
<Table.ColumnHeader>Price</Table.ColumnHeader>
<Table.ColumnHeader>Total</Table.ColumnHeader>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell sticky="5rem">1</Table.Cell>
<Table.Cell>Product 1</Table.Cell>
<Table.Cell>1</Table.Cell>
<Table.Cell>100</Table.Cell>
<Table.Cell>100</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell sticky="5rem">2</Table.Cell>
<Table.Cell>Product 2</Table.Cell>
<Table.Cell>2</Table.Cell>
<Table.Cell>200</Table.Cell>
<Table.Cell>400</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell sticky="5rem">3</Table.Cell>
<Table.Cell>Product 3</Table.Cell>
<Table.Cell>3</Table.Cell>
<Table.Cell>300</Table.Cell>
<Table.Cell>900</Table.Cell>
</Table.Row>
</Table.Body>
<Table.Footer>
<Table.Row>
<Table.Cell sticky="5rem">Total</Table.Cell>
<Table.Cell />
<Table.Cell>6</Table.Cell>
<Table.Cell />
<Table.Cell>1500</Table.Cell>
</Table.Row>
</Table.Footer>
</Table.Root>
</div>
);
NameTypeRequiredDefaultDescription
sizeSizemdThe size of the table
densebooleanfalseWhether to use a dense table
showBorderbooleanfalseWhether to show the table border
showRowStripebooleanfalseWhether to show the row stripe
showRowBorderbooleanfalseWhether to show the row border
showColumnBorderbooleanfalseWhether to show the column border
NameTypeRequiredDefaultDescription
stickybooleanfalseWhether to make the header sticky
NameTypeRequiredDefaultDescription
stickyCssUnit | booleanWhether to make the column header sticky 1
colSpannumberThe number of columns the column header should span
rowSpannumberThe number of rows the column header should span
  1. Set width CSS property to make the column header sticky.
NameTypeRequiredDefaultDescription
stickyCssUnit | booleanWhether to make the cell sticky 1
colSpannumberThe number of columns the cell should span
rowSpannumberThe number of rows the cell should span
  1. Set width CSS property to make the cell sticky.
type CssUnit = `${number}${'em' | 'px' | 'rem' | 'vh' | 'vw' | '%'}`
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl'