• Stars
    star
    799
  • Rank 57,011 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 2 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A fully featured Mantine V5 implementation of TanStack React Table V8, forked from Material React Table

Mantine React Table

View the Docs Site

A work in progress fork of Material React Table

Coming soon in early 2023, but you can try out the beta now.

About

Quickly Create React Data Tables with Mantine

Built with Mantine V5 and TanStack Table V8

MRT

Learn More

Quick Examples

View additional storybook examples

Features

All features can easily be enabled/disabled

Fully Fleshed out Docs are available for all features

  • < 44kb gzipped - Bundlephobia
  • Advanced TypeScript Generics Support (TypeScript Optional)
  • Aggregation and Grouping (Sum, Average, Count, etc.)
  • Click To Copy Cell Values
  • Column Action Dropdown Menu
  • Column Hiding
  • Column Ordering via Drag'n'Drop
  • Column Pinning (Freeze Columns)
  • Column Resizing
  • Customize Icons
  • Customize Styling of internal Mantine Components
  • Data Editing (4 different editing modes)
  • Density Toggle
  • Detail Panels (Expansion)
  • Filtering (supports client-side and server-side)
  • Filter Match Highlighting
  • Full Screen Mode
  • Global Filtering (Search across all columns, rank by best match)
  • Header Groups & Footers
  • Localization (i18n) support
  • Manage your own state or let the table manage it internally for you
  • Pagination (supports client-side and server-side)
  • Row Actions (Your Custom Action Buttons)
  • Row Numbers
  • Row Ordering via Drag'n'Drop
  • Row Selection (Checkboxes)
  • SSR compatible
  • Sorting (supports client-side and server-side)
  • Theming (Respects your Mantine Theme)
  • Toolbars (Add your own action buttons)
  • Tree Data / Expanding Sub-rows
  • Virtualization (@tanstack/react-virtual)

Getting Started

Installation

View the full Installation Docs

  1. Ensure that you have React 17 or later installed

  2. Install Peer Dependencies (Mantine V6 and Tabler Icons)

npm install @mantine/core @mantine/hooks @mantine/dates @emotion/react @tabler/icons-react dayjs
  1. Install mantine-react-table
npm install mantine-react-table

@tanstack/react-table, @tanstack/react-virtual, @tanstack/match-sorter-utils, are internal dependencies, so you do NOT need to install them yourself.

Usage

Read the full usage docs here

import { useMemo, useRef, useState, useEffect } from 'react';
import { MantineReactTable, useMantineReactTable } from 'mantine-react-table';

const data = [
  {
    name: 'John',
    age: 30,
  },
  {
    name: 'Sara',
    age: 25,
  },
]

export default function App() {
  const columns = useMemo(
    () => [
      {
        accessorKey: 'name', //simple recommended way to define a column
        header: 'Name',
        mantineTableHeadCellProps: { sx: { color: 'green' } }, //optional custom props
        Cell: ({ cell }) => <span>{cell.getValue()}</span>, //optional custom cell render
      },
      {
        accessorFn: (row) => row.age, //alternate way
        id: 'age', //id required if you use accessorFn instead of accessorKey
        header: 'Age',
        Header: () => <i>Age</i>, //optional custom header render
      },
    ],
    [],
  );

  //optionally, you can manage any/all of the table state yourself
  const [rowSelection, setRowSelection] = useState({});

  useEffect(() => {
    //do something when the row selection changes
  }, [rowSelection]);

  const table = useMantineReactTable({
    columns,
    data,
    enableColumnOrdering: true, //enable some features
    enableRowSelection: true,
    enablePagination: false, //disable a default feature
    onRowSelectionChange: setRowSelection, //hoist row selection state to your state
    state: { rowSelection },
  });
  
  return <MantineReactTable table={table} />;
}

Open in Code Sandbox

Contributors

PRs are Welcome, but please discuss in GitHub Discussions or the Discord Server first if it is a large change!

Read the Contributing Guide to learn how to run this project locally.

More Repositories

1

material-react-table

A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript
TypeScript
1,462
star
2

multi-monitor_calculator

A tool for planning your multi-monitor setup. Formerly written in React (and before that PHP and jQuery), but now in Sveltekit!
Svelte
38
star
3

react-query-demos

2 identical apps. 1 written with React Query and the other using traditional useEffects for fetching
TypeScript
6
star
4

jeopardy

C#
5
star
5

material-svelte-table

JavaScript
4
star
6

MathWiz

MathWiz
C#
4
star
7

Rapidstrap

A lightweight CSS only library to get your projects started rapidly with short and intuitive class names for commonly used CSS.
CSS
2
star
8

react-data-fetching

TypeScript
2
star
9

WeatherWolf-React

JavaScript
1
star
10

tanstack-table-ui

Experimental
Astro
1
star
11

southeast-ASP-GP-SCCBakery

SCC Group Project in ASP using C#
JavaScript
1
star
12

group-run

JavaScript
1
star
13

kevinvancott

portfolio
TypeScript
1
star
14

material-solid-table

TypeScript
1
star
15

contact-keeper

JavaScript
1
star
16

uPlanner

PHP
1
star
17

tellmeastory

TypeScript
1
star
18

WeatherWolf-Grails

JavaScript
1
star
19

pc_planning_tool

A tool to help users keep track of parts that they are shopping for while building a PC. This project is written in PHP and Javascript
PHP
1
star
20

github-user-finder

JavaScript
1
star
21

typescript.coffee

Astro
1
star
22

news-pwa

JavaScript
1
star
23

chatbot-learning

TypeScript
1
star
24

tanstack-vs-no-tanstack

2 identical apps. 1 without TanStack, and one with TanStack Router, Query, Table, Virtual, and Form
TypeScript
1
star