A its core, the Data Grid controls little to nothing regarding how it looks.
Essentially, the visual style is controlled by the cell content, Cerberus React primitives it uses (e.g., menus, pagination, etc.), and the Cerberus theme that is active from your Panda CSS config.
Having said that, what little things are visually styled, can be customized via
the theme prop of the DataGrid component.
To customize the theme, pass an Object of options to the theme prop in the DataGrid
component.
In the example below, we change six properties in addition to creating a vertical legend to show to the left of the Data Grid.
Take note of how the Column definitions are also providing customized cell content in a way that also changes the appearance of the layout.
To provide the best typescript experience, we recommend assigning the ThemeOptions
type to a constant that will define your theme. This will enforce auto-completion
while holding the constant accountable to fulfill the ThemeOptions type.
The theme prop takes an Object with the following properties:
| Params | Type | Description |
|---|---|---|
borderColor | string | The external border of the Data Grid container. The default is page.border.initial |
border | string | The border width and style of the Data Grid component. Default is 1px solid. |
rounded | string | The border radius of the Data Grid component. Default is lg. |
rowBgColor | string | The background color of the row. Default is page.surface.100. |
rowHoverBgColor | string | The background color of the row on hover. Default is page.surface.200. |
rowEvenBgColor | string | The background color of the even rows. Default is page.surface.initial. |
headCellBgColor | string | The background color of the head cell. Default is page.bg.initial. |
headCellBorderBottomColor | string | The border color for the bottom border of the head cell. Default is page.border.200. |
gridCellBorderColor | string | The border color of the grid cell. Default is page.border.200. |
gridCellPinnedBorderColor | string | The border color of the pinned grid cell. Default is page.border.200. |