Skip to main content

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​

PropTypeDefaultDescription
themeDataGridThemeLight themePartial overrides.
getRowStyle(row, index) => StyleProp<ViewStyle>NoneStyle per row.
zebraRowsbooleanfalseAlternate row backgrounds.
compactbooleanfalseReduces row height by 8, with a floor of 34.
styleStyleProp<ViewStyle>NoneStyle for the outer container.

Theme keys​

KeyDefault
headerBackground#F3F4F6
headerTextColor#111827
rowBackground#FFFFFF
rowAltBackground#F9FAFB
rowTextColor#111827
borderColor#D1D5DB
borderRadius0
dividerColor#E5E7EB
selectionBackground#DBEAFE
toolbarBackground#F9FAFB
toolbarTextColor#374151
footerBackground#F9FAFB
cellPadding10
headerHeight44
footerHeight58
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.