Describe the bug
The DataTable component features a styles prop that expects MantineStyleProp for keys root, table, header, footer, and pagination.
Mantine defines MantineStyleProp as follows:
type MantineStyle = CSSProperties | ((theme: MantineTheme) => CSSProperties);
type MantineStyleProp = MantineStyle | MantineStyle[] | MantineStyleProp[] | undefined;
As a result, it should accept functions receiving the Mantine theme, as well as arrays of CSSProperties or functions. However, passing a style function results in the styles not being applied, while passing an array throws the following runtime error:
TypeError: Failed to set an indexed property [0] on 'CSSStyleDeclaration': Indexed property setter is not supported.
To Reproduce
Minimal example passing a style function:
<DataTable
records={[{ id: 1 }]}
columns={[{ accessor: 'id' }]}
styles={{
table: () => ({
color: 'red',
}),
}}
/>
Minimal example passing an array:
<DataTable
records={[{ id: 1 }]}
columns={[{ accessor: 'id' }]}
styles={{
table: [{ color: 'red' }],
}}
/>
Expected behavior
In both cases, the text color should be red. When passing a function, the text remains black. When passing an array, the table fails to render and throws a TypeError.
Describe the bug
The
DataTablecomponent features astylesprop that expectsMantineStylePropfor keysroot,table,header,footer, andpagination.Mantine defines
MantineStylePropas follows:As a result, it should accept functions receiving the Mantine theme, as well as arrays of
CSSPropertiesor functions. However, passing a style function results in the styles not being applied, while passing an array throws the following runtime error:To Reproduce
Minimal example passing a style function:
Minimal example passing an array:
Expected behavior
In both cases, the text color should be red. When passing a function, the text remains black. When passing an array, the table fails to render and throws a
TypeError.