---
id: table
title: Table
---

# Table

## How to use

<code src="@digigov/ui/src/content/Table/__stories__/Default.tsx" />

### With dark header

<code src="@digigov/ui/src/content/Table/__stories__/DarkVariant.tsx" />

### With captions

Use the `<TableCaption>` element to describe a table in the same way you would use a heading. A caption helps users find, navigate and understand tables.

<code src="@digigov/ui/src/content/Table/__stories__/TableCaptions.tsx" />

### With numeric values

<code src="@digigov/ui/src/content/Table/__stories__/NumericDataType.tsx" />

### With zebra rows

<code src="@digigov/ui/src/content/Table/__stories__/ZebraProp.tsx" />

### With primary or secondary colored rows

The prop `color='primary'` or `color='secondary'` is only functional when Table component has `variant='default'`.

<code src="@digigov/ui/src/content/Table/__stories__/RowColors.tsx" />

### With vertical lines

<code src="@digigov/ui/src/content/Table/__stories__/VerticalBorders.tsx" />

### With dense style

<code src="@digigov/ui/src/content/Table/__stories__/Dense.tsx" />

### Custom column widths

<code src="@digigov/ui/src/content/Table/__stories__/DefinedWidth.tsx" />

### Without data (empty table)

<code src="@digigov/ui/src/content/Table/__stories__/NoData.tsx" />

### With loader

<code src="@digigov/ui/src/content/Table/__stories__/WithLoader.tsx" />

### With stack style

Use this prop when you want to display a more user friendly table for small screens.

<code src="@digigov/ui/src/content/Table/__stories__/Stacked.tsx" />

## Accessibility

You can read more about the accessibility patterns used in our Table
implementation in the ARIA Authoring Practices Guide (APG) at [Table](https://www.w3.org/WAI/ARIA/apg/patterns/table/) section.

## API

See below for a complete reference to all of the props  available to the components mentioned here.

<ComponentProps componentName={[
  "TableContainer",
  "Table",
  "TableCaption",
  "TableHead",
  "TableRow",
  "TableBody",
  "TableHeadCell",
  "TableDataCell"
  ]
} />
