All Projects → davidalekna → use-table-tools

davidalekna / use-table-tools

Licence: MIT License
React Hooks for building kickass react table components

Programming Languages

typescript
32286 projects
CSS
56736 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to use-table-tools

React Table
⚛️ Hooks for building fast and extendable tables and datagrids for React
Stars: ✭ 15,739 (+87338.89%)
Mutual labels:  hooks, grid, table
Angular Generic Table
A generic table for Angular 2+. Generic table uses standard markup for tables ie. table, tr and td elements etc. and has support for expanding rows, global search, filters, sorting, pagination, export to CSV, column clicks, custom column rendering, custom export values.
Stars: ✭ 100 (+455.56%)
Mutual labels:  grid, responsive, table
svelte-grid-responsive
Responsive grid system based on Bootstrap for Svelte
Stars: ✭ 41 (+127.78%)
Mutual labels:  grid, responsive
streamlit-aggrid
Implementation of Ag-Grid component for Streamlit
Stars: ✭ 465 (+2483.33%)
Mutual labels:  grid, table
react-auto-mosaic
Automatic box behavior in the grid - responsive mosaic
Stars: ✭ 12 (-33.33%)
Mutual labels:  grid, responsive
BeeGridTable
BeeGridTable , is a Highly Customizable Table UI component library based on Vue.js. Rich functions、More efficient、Easy to use!
Stars: ✭ 45 (+150%)
Mutual labels:  grid, table
terminal-columns
Render readable & responsive tables in the terminal
Stars: ✭ 27 (+50%)
Mutual labels:  responsive, table
responsive-css-grid
A super-lightweight, responsive, 8-column grid based on box-sizing
Stars: ✭ 46 (+155.56%)
Mutual labels:  grid, responsive
vue-grid-responsive
Responsive grid system based on Bootstrap for Vue
Stars: ✭ 27 (+50%)
Mutual labels:  grid, responsive
react-keyview
React components to display the list, table, and grid, without scrolling, use the keyboard keys to navigate through the data
Stars: ✭ 16 (-11.11%)
Mutual labels:  grid, table
ExpandedCollectionBundle
Symfony bundle for render entity collections as a selectable expanded list.
Stars: ✭ 13 (-27.78%)
Mutual labels:  table, checkboxes
reactools
Create React interfaces is easy.
Stars: ✭ 14 (-22.22%)
Mutual labels:  hooks, tools
ekzo
💫 Functional Sass framework for rapid and painless development
Stars: ✭ 32 (+77.78%)
Mutual labels:  grid, responsive
griding
🧱 lean grid & responsive for react
Stars: ✭ 18 (+0%)
Mutual labels:  grid, responsive
tb-grid
tb-grid is a super simple and lightweight 12 column responsive grid system utilizing css grid.
Stars: ✭ 19 (+5.56%)
Mutual labels:  grid, responsive
react-super-styled
Responsive JSX layouts with Styled Components
Stars: ✭ 77 (+327.78%)
Mutual labels:  grid, responsive
bootstrap-grid-ms
Missing grid range in Bootstrap 3, micro-small from 480-767px.
Stars: ✭ 34 (+88.89%)
Mutual labels:  grid, responsive
jui-grid
JUI grid can handle millions of data, and can display the data in a hierarchical structure.
Stars: ✭ 12 (-33.33%)
Mutual labels:  grid, table
react-bolivianite-grid
React grid component for virtualized rendering large tabular data.
Stars: ✭ 95 (+427.78%)
Mutual labels:  grid, table
react-datasheet-grid
An Airtable-like / Excel-like component to create beautiful spreadsheets.
Stars: ✭ 227 (+1161.11%)
Mutual labels:  grid, table

use-table-tools

React Hooks for building kickass react table components

Build Status MIT License PRs Welcome gzip size

Introduction

use-table-tools is a React Hooks library for building kickass react table components.

It features:

  • flexbox table with adjustable column configuration
  • checkboxes with multi select
  • client side sorting
  • shifting columns into or off view
  • number of visible columns per screen resolution

Example gif video

Quick Start

import { useTableTools } from 'use-table-tools';

function Table() {
  const { ...utils } = useTableTools({
    layout: [''],
    columns: [],
    totalItems: 0,
  });

  return <div>hello from table component</div>;
}

Usage

Inside your React project directory, run the following:

yarn add use-table-tools

or with npm

npm install use-table-tools

API

Parameters

  • layout?: { [key: number]: string[] } | string[]: layout of the table. Can be a string of flex props per column ['0 0 25%', '1 1 35%', '0 0 20%', '0 0 20%'] or an object with flex props per breakpoint where the key is a breakpoint and the value is a flex props per column.
const layout = {
  280: ['0 0 100%'],
  348: ['0 0 50%', '0 0 50%'],
  768: ['0 0 35%', '1 1 35%', '0 0 30%'],
  1280: ['0 0 25%', '1 1 35%', '0 0 20%', '0 0 20%'],
};
  • columns: ColumnProps[]: define a shape of your data by providing what items should exist on the table component. It will accept and array of objects with the label, fieldKey and locked properties. Where fieldKey is the key name on you data object, rest is props for the table tools
  • totalItems: number: total items per page, required for the checkboxes to determin the state when all items selected
  • clientSortBy?: SortProps: initial client sort for the table
  • checkedItems?: string[]: initialize with already checked items

Return Values

  • switchColumns: (from: string, to: string) => void: provide colums keys from sortKey to sortKey and they will get replaced
  • switchCurrentLayout: (currentLayout: string[]) => void: will switch current layout to the given one and will update visible and offset columns. Also used to automatically adjust if layout has breakpoints defined.
  • offsetColumns: (obj?: { includeVisible: boolean }) => ColumnProps[]: shows offset columns with the ability to include visible ones as well
  • onSelection: (items: string[]) => void: should be applied to master checkbox input onClick action with visible item ids.
  • deselectAll: () => void: clears the state of selected item ids
  • selectAll: (checkedItems: string[]) => void: selects all items
  • checkboxToggle: (evt: ChangeEvent<HTMLInputElement>) => void: toggles checkbox by id
  • checkboxShiftToggle: (evt: ChangeEvent<HTMLInputElement>) => void: toggles checkbox by id and selects/deselects a range when shift key is on
  • checkboxState: (id: string) => boolean: returns a boolean state for the checkbox by id
  • clientSortMethod: (a: object, b: object) => number: method to be used in a sort function, like ramda sort
  • changeSortDirection: (direction: SortProps['direction']) => void: change current sort direction by specifying next direction
  • toggleSortDirection: () => void: toggle current sort field direction
  • toggleSortByKey: (fieldKey: string) => void: toggle sort direction on a field key
  • sortData: (sortProps: SortProps) => void: sorts data by provided sortField and direction props
  • activeSort: (sortProps: SortProps) => boolean: checks the state of the current active sort by key and direction
  • activeSortKey: (key: string) => boolean: checks the state of the current active sort by key
  • getCheckboxProps: ({...}) => CheckboxProps: spread checkbox props on the checkbox input

Options

Global Configuration

React Context API

<TableTools>{(utils) => <div />}</TableTools>
const utils = useTableToolsContext();

Examples

In progress...

LICENSE

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].