Theming
Override any part of the theme. Keys you leave out keep their defaults.
Basic usage
theme-dark.tsx
import { DataGrid, type DataGridTheme } from 'expo-flash-datagrid';
import { userColumns, users, type User } from './data';
const darkTheme: DataGridTheme = {
headerBackground: '#14233C',
headerTextColor: '#E6EEF9',
rowBackground: '#0D1A2E',
rowAltBackground: '#111F36',
rowTextColor: '#D8E4F6',
borderColor: '#24395C',
dividerColor: '#1C2E4C',
selectionBackground: '#1D3A66',
toolbarBackground: '#0D1A2E',
toolbarTextColor: '#D8E4F6',
footerBackground: '#0D1A2E',
borderRadius: 12,
cellPadding: 12,
headerHeight: 48,
footerHeight: 56,
};
export function DarkGridScreen() {
return (
<DataGrid<User>
mode="client"
rows={users}
columns={userColumns}
theme={darkTheme}
zebraRows
getRowStyle={(row) =>
row.status === 'paused' ? { opacity: 0.6 } : undefined
}
style={{ flex: 1 }}
/>
);
}
Options
| Prop | Type | Default | Description |
|---|---|---|---|
theme | DataGridTheme | Light theme | Partial overrides. |
getRowStyle | (row, index) => StyleProp<ViewStyle> | None | Style per row. |
zebraRows | boolean | false | Alternate row backgrounds. |
compact | boolean | false | Reduces row height by 8, with a floor of 34. |
style | StyleProp<ViewStyle> | None | Style for the outer container. |
Theme keys
| Key | Default |
|---|---|
headerBackground | #F3F4F6 |
headerTextColor | #111827 |
rowBackground | #FFFFFF |
rowAltBackground | #F9FAFB |
rowTextColor | #111827 |
borderColor | #D1D5DB |
borderRadius | 0 |
dividerColor | #E5E7EB |
selectionBackground | #DBEAFE |
toolbarBackground | #F9FAFB |
toolbarTextColor | #374151 |
footerBackground | #F9FAFB |
cellPadding | 10 |
headerHeight | 44 |
footerHeight | 58 |
note
theme covers the toolbar, header, rows, and footer. The search, filter, and column dialogs and the row action menu keep their built-in light appearance.
Client vs server
Theming is independent of the mode.