GithubHelp home page GithubHelp logo

fork-archive-hub / tableus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zendricom/tableus

0.0 0.0 0.0 784 KB

A react library for rendering highly configurable tables.

TypeScript 100.00%

tableus's Introduction

Tableus

A react library for rapidly building highly configurable tables flawlessly integrated with your backend

Summary

Tableus offers a configurable out-of-the-box react table. It is intended to be integrated fully with your backend to deliver tables with sorting, filtering and pagination. Tableus does not state any requirements on your preferred UI (bootstrap, material UI, etc.) or backend API (REST, GraphQL, etc.), by externalizing those into seperate modules called fetchers and UIs.
If your UI and backend API are already available as a package, then you are ready to go to create complex tables with minimal effort and zero boilerplate. Tableus is built on top of Tanstack Table and often the API is the same. If you are already familiar with Tanstack Table (formerly React Table), then you will feel familiar with Tableus fast!

Available Fetchers & UIs

Fetchers

UIs

Installation

npm install @tableus/core
npm install @tableus/fetcher-[your-preferred-fetcher]
npm install @tableus/ui-[your-preferred-ui]```

Requirements

  • Your preferred UI has to be available as a package. If not you have to implement a tableus-ui yourself. Look here on how to do that.
  • Your backend API has to be compatible with one of the available fetchers. If not you have to implement a tableus-fetcher yourself. Look here on how to do that.
  • You have to provide a QueryClient from react-query in your App, as tableus uses react-query under the hood to improve performance.

Quick Start

  1. Provide a project-wide TableusConfig with the TableusContextProvider, where you specify your UI. Also be sure that a react-query QueryClient is provided .
import { initTableComponents } from '@tableus/ui-bootstrap5';
import { TableusConfig } from '@tableus/core/dist/context';
import { TableusContextProvider } from '@tableus/core';
import { QueryClient, QueryClientProvider } from 'react-query';

const tableusConfig: TableusConfig = {
  tableUI: initTableComponents(),
};

const queryClient = new QueryClient();

export function App() {
  return (
    <QueryClientProvider client={queryClient}>
      <TableusContextProvider config={tableusConfig}>
        {...}
      </TableusContextProvider>
    </QueryClientProvider>
  );
}
  1. Init the table object and pass the type data that the table will display.
const table = createTable<TableEntry>();
  1. Specify the columns of your table.
const columns = [
  table.createDataColumn("id", {
    header: "ID",
  }),
  table.createDataColumn(
    (row) => `${row.user.firstname} ${row.user.lastname}`,
    {
      id: "name",
      header: "Name",
    }
  ),
];
  1. Initialize your fetcher. E.g. here we use a REST fetcher. The url /users should return an array of users in the format expected by the LaravelRestFetcher, where each entry is of the form of TableEntry.
const fetcher = new LaravelRestFetcher<TableEntry>("/users");
  1. Call useTableus.
const { tableusProps } = useTableus(table, {
  columns,
  fetcher,
  key: "users",
});
  1. Render Tableus
<Tableus {...tableusProps} />
  1. Done!

tableus's People

Contributors

mogottsch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.