# DataTable component for Stripe Apps Use DataTable to display tabular data in your Stripe app. # v8 > This is a v8 for when app-sdk-version is 8. View the full page at https://docs.stripe.com/stripe-apps/components/datatable?app-sdk-version=8. The `DataTable` component isn’t available in the selected SDK version. # v9 > This is a v9 for when app-sdk-version is 9. View the full page at https://docs.stripe.com/stripe-apps/components/datatable?app-sdk-version=9. To add the `DataTable` component to your app: ```js import {DataTable} from '@stripe/ui-extension-sdk/ui'; ``` The `DataTable` component provides a structured way to display tabular data within a Stripe App. It supports column configuration, row actions, pagination, batch selection, and column reordering out of the box. ### DataTable props | Property | Type | | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `columns` | (Required) `DataTableColumn[]` Related types: [DataTableColumn](https://docs.stripe.com/stripe-apps/components/datatable.md#datatablecolumn). | | `items` | (Required) `DataTableItem[]` | | `batchable` | (Optional) `Batchable | undefined` Defines the configuration for multi-select row behavior. Related types: [Batchable](https://docs.stripe.com/stripe-apps/components/datatable.md#batchable). | | `loading` | (Optional) `boolean | undefined` Set the table to a loading state. | | `onColumnOrderChange` | (Optional) `((order: DataTableColumn[]) => void) | undefined` A callback that is invoked when table column order is changed. Related types: [DataTableColumn](https://docs.stripe.com/stripe-apps/components/datatable.md#datatablecolumn). | | `onPageChange` | (Optional) `((pageIndex: number) => void) | undefined` A callback that is invoked when table page is changed. | | `onRowClick` | (Optional) `((item: DataTableItem) => void) | undefined` An event handler for when the user clicks a table row. | | `rowActions` | (Optional) `(DataTableRowAction | DataTableRowActionGroup)[] | undefined` Actions to display in the row. Related types: [DataTableRowActionGroup](https://docs.stripe.com/stripe-apps/components/datatable.md#datatablerowactiongroup), [DataTableRowAction](https://docs.stripe.com/stripe-apps/components/datatable.md#datatablerowaction). | ### DataTableColumn | Property | Type | | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `key` | (Required) `string` The unique identifier for the column. | | `label` | (Required) `string` The label to display for the column. | | `cell` | (Optional) `DataTableCell | undefined` Cell format options. Related types: [DataTableCell](https://docs.stripe.com/stripe-apps/components/datatable.md#datatablecell). | | `hideHeaderLabel` | (Optional) `boolean | undefined` Sets the column label to be hidden. | | `pinned` | (Optional) `boolean | undefined` Whether the column is pinned. | ### DataTableCell This is a union type. It can be one of: [TextTableCell](https://docs.stripe.com/stripe-apps/components/datatable.md#texttablecell), [LinkTableCell](https://docs.stripe.com/stripe-apps/components/datatable.md#linktablecell), [DateTableCell](https://docs.stripe.com/stripe-apps/components/datatable.md#datetablecell), [IdTableCell](https://docs.stripe.com/stripe-apps/components/datatable.md#idtablecell), [StatusTableCell](https://docs.stripe.com/stripe-apps/components/datatable.md#statustablecell), [CurrencyTableCell](https://docs.stripe.com/stripe-apps/components/datatable.md#currencytablecell). ### TextTableCell | Property | Type | | -------- | ---------------------------------------------- | | `type` | (Required) `"text"` The type of the cell. | ### LinkTableCell | Property | Type | | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `type` | (Required) `"link"` The type of the cell. | | `linkMap` | (Optional) `{ [x: string]: string; } | undefined` A map of URLs to link text. If no mapping is found for a URL, the URL itself is used as the link text. | ### DateTableCell | Property | Type | | -------- | ---------------------------------------------- | | `type` | (Required) `"date"` The type of the cell. | ### IdTableCell | Property | Type | | -------- | -------------------------------------------- | | `type` | (Required) `"id"` The type of the cell. | ### StatusTableCell | Property | Type | | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | `statusMap` | (Required) `{ [x: string]: "neutral" | "urgent" | "warning" | "negative" | "positive" | "info"; }` A map of cell values to status types. | | `type` | (Required) `"status"` The type of the cell. | ### CurrencyTableCell | Property | Type | | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `currency` | (Required) `string` Three-letter ISO-4217 currency code or a non-ISO currency code like `USDC` for USD Coin or `BTC` for Bitcoin. | | `type` | (Required) `"currency"` The type of the cell. | | `currencyMap` | (Optional) `{ [x: string]: CurrencyCode; } | undefined` Specifies a per-item currency code override, keyed by table item id. If an item id is not present in the map, the value of currency is used. This allows a single column to display multiple currencies. | ### Batchable | Property | Type | | --------------- | --------------------------------------------------------------------------- | | `onBatchChange` | (Required) `(selectedItems: { [x: string]: DataTableItem; }) => void` | ### DataTableRowAction | Property | Type | | --------- | --------------------------------------------------------------------------------- | | `id` | (Required) `string` The unique identifier for the action. | | `label` | (Required) `string` The label of the action. | | `onPress` | (Required) `(item: DataTableItem) => void` An event handler for the action. | | `type` | (Optional) `("default" | "destructive") | undefined` The type of the action. | ### DataTableRowActionGroup | Property | Type | | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `actions` | (Required) `DataTableRowAction[]` The actions to display in the action group. Related types: [DataTableRowAction](https://docs.stripe.com/stripe-apps/components/datatable.md#datatablerowaction). | | `id` | (Required) `string` The unique identifier for the action group. | | `label` | (Required) `string` The label of the action group. | ## Advanced Use column pinning, cell formatting, row actions, batch selection, pagination, and column reordering together to build a full-featured data table. ## See also - [Design patterns to follow](https://docs.stripe.com/stripe-apps/patterns.md) - [Style your app](https://docs.stripe.com/stripe-apps/style.md) - [UI testing](https://docs.stripe.com/stripe-apps/ui-testing.md)