Skip to content

Build a datatable component based on this package to have default configurations using typescript #496

Answered by reintroducing
ceciiiron asked this question in Q&A
Discussion options

You must be logged in to vote

here is a custom component i built to do practically the same, hopefully it helps you:

import {ReactNode} from 'react';
import cx from 'clsx';
import {Paper} from '@mantine/core';
import {DataTable, DataTableProps} from 'mantine-datatable';
import {IconChevronUp, IconSelector} from '@tabler/icons-react';
import css from './Table.module.css';

export type TableProps<T = Record<string, unknown>> = DataTableProps<T> & {
    header?: ReactNode;
    footer?: ReactNode;
};

const Table = <T,>({
    noRecordsText = 'No data available. If filters are applied, try resetting them.',
    header,
    footer,
    ...props
}: TableProps<T>) => (
    <Paper withBorder>
        {header && <div className=…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ceciiiron
Comment options

Answer selected by ceciiiron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants