yarn add @twilio-paste/data-grid - or - yarn add @twilio-paste/core
import {
DataGrid,
DataGridHead,
DataGridRow,
DataGridHeader,
DataGridBody,
DataGridCell,
DataGridFoot,
} from '@twilio-paste/core/data-grid';
const Component = () => (
<DataGrid aria-label="User information table" striped>
<DataGridHead>
<DataGridRow>
<DataGridHeader>First Name</DataGridHeader>
<DataGridHeader>Last Name</DataGridHeader>
<DataGridHeader>Country</DataGridHeader>
<DataGridHeader>Email</DataGridHeader>
<DataGridHeader>Phone</DataGridHeader>
</DataGridRow>
</DataGridHead>
<DataGridBody>
<DataGridRow>
<DataGridCell>Devyn</DataGridCell>
<DataGridCell>Weimann</DataGridCell>
<DataGridCell>Congo</DataGridCell>
<DataGridCell>Matilde86@gmail.com</DataGridCell>
<DataGridCell>652-441-1766 x377</DataGridCell>
</DataGridRow>
<DataGridRow>
<DataGridCell>Fritz</DataGridCell>
<DataGridCell>Bashirian</DataGridCell>
<DataGridCell>France</DataGridCell>
<DataGridCell>Magali.Harber@hotmail.com</DataGridCell>
<DataGridCell>1-229-278-7567</DataGridCell>
</DataGridRow>
<DataGridRow>
<DataGridCell>Jovanny</DataGridCell>
<DataGridCell>Mante</DataGridCell>
<DataGridCell>Pitcairn Islands</DataGridCell>
<DataGridCell>Fausto_Vandervort15@gmail.com</DataGridCell>
<DataGridCell>(629) 375-5743 x726</DataGridCell>
</DataGridRow>
</DataGridBody>
<DataGridFoot>
<DataGridRow>
<DataGridCell>Devyn</DataGridCell>
<DataGridCell>Weimann</DataGridCell>
<DataGridCell>Congo</DataGridCell>
<DataGridCell>Matilde86@gmail.com</DataGridCell>
<DataGridCell>652-441-1766 x377</DataGridCell>
</DataGridRow>
</DataGridFoot>
</DataGrid>
);
aria-label RequiredRequired
- Type
string
element
Overrides the default element name to apply unique styles with the Customization Provider
- Type
any
- Default
'DATA_GRID'
role
If creating a treegrid, set this to "treegrid" to override the default role of "grid"
- Type
"treegrid"
- Default
grid
Inherited props
Paste components will often extend native HTML elements and as a result will inherit or extend their available properties. Below is a list of the props this component has inherited and are also available to use.
element
Overrides the default element name to apply unique styles with the Customization Provider
- Type
string
- Default
'DATA_GRID_HEAD'
Inherited props
Paste components will often extend native HTML elements and as a result will inherit or extend their available properties. Below is a list of the props this component has inherited and are also available to use.
element
Overrides the default element name to apply unique styles with the Customization Provider
- Type
any
- Default
'DATA_GRID_ROW'
role
- Type
string
selected
Visally displays a row highlight indicating selection and sets aria-selected
- Type
boolean
striped
- Type
boolean
Inherited props
Paste components will often extend native HTML elements and as a result will inherit or extend their available properties. Below is a list of the props this component has inherited and are also available to use.
element
Overrides the default element name to apply unique styles with the Customization Provider
- Type
any
- Default
'DATA_GRID_HEADER'
onClick
- Type
MouseEventHandler<Element>
Inherited props
Paste components will often extend native HTML elements and as a result will inherit or extend their available properties. Below is a list of the props this component has inherited and are also available to use.
direction RequiredRequired
Sort direction matching aria spec
- Type
SortDirection
element
Overrides the default element name to apply unique styles with the Customization Provider
- Type
any
- Default
'DATA_GRID_HEADER_SORT'
i18nAscendingLabel
Sort button label text when direction
is "ascending"
- Type
string
- Default
'Sort ascending'
i18nDescendingLabel
Sort button label text when direction
is "descending"
- Type
string
- Default
'Sort descending'
i18nUnsortedLabel
Sort button label text when direction
is "none"
- Type
string
- Default
'Unsorted'
onClick
Callback when the sort button is pressed. Used to handle sorting.
- Type
() => void
tabIndex
- Type
any
Inherited props
Paste components will often extend native HTML elements and as a result will inherit or extend their available properties. Below is a list of the props this component has inherited and are also available to use.
Inherited props
Paste components will often extend native HTML elements and as a result will inherit or extend their available properties. Below is a list of the props this component has inherited and are also available to use.
as
- Type
"th" | "td"
colSpan
How many columns the cell spans across
- Type
number
element
Overrides the default element name to apply unique styles with the Customization Provider
- Type
any
- Default
'DATA_GRID_CELL'
onClick
- Type
MouseEventHandler<Element>
Inherited props
Paste components will often extend native HTML elements and as a result will inherit or extend their available properties. Below is a list of the props this component has inherited and are also available to use.
element
Overrides the default element name to apply unique styles with the Customization Provider
- Type
any
- Default
'DATA_GRID_FOOT'
Inherited props
Paste components will often extend native HTML elements and as a result will inherit or extend their available properties. Below is a list of the props this component has inherited and are also available to use.