0.0.2 • Published 2 years ago

@craft-code/react-tanstack-table v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

React tanstack-table

 

About

taillwind (twin.macro) based implementation of @tanstack/react-table headless library, follows the meterial design look and feel (mostly)

 

main features:

  1. column filter
  2. column sort
  3. custom cell content
  4. column visibility
  5. client-side pagination
  6. server-side pagination
  7. dark mode 🌚

 

options and props

nametypedescription
data*Tdata to display in the table rows
columnDef*columnDef\<T>column display definition
darkbooleanswitch to dark mode
variantTableVariants | TableVariants[]overall look of the table
ActionAreaReact.ReactNodecomponent to show nexet to the pagination
asyncDataLengthnumberfor server-side pagination mode
isLoadingbooleantoggles the view of the loading component
LabelsITableLabelsstatic strings and components for localization
maxHeightstring | numbermax height for the whole compnent table+controls
rowsPerPageOptionsListnumber[]options for the page lenght select
paginationModePaginationModesspecifies how the pagination work
paginationPropsIPaginationPropertiespagination state & control
tableElemPropsReact.ComponentProps<"table">basic props that is passed to the \ elemnt
tableSettingsITableSettings\<T>---

 

types & interfaces

TableVariants

type TableVariants =
  | "stripped"
  | "primary"
  | "secondary"
  | "hover"
  | "borders"
  | "out-border"
  | "contrast-header"
  | "sticky-header"
  | "sticky-controls"; // you might need this in some situations
  | undefined

ITableLabels

interface ITableLabels {
  noData: React.ReactNode;
  loading: React.ReactNode;
  pagination?: {
    from?: string;
    to?: string;
    rowsPerPage?: string;
  };
}

PaginationModes

type PaginationModes = "client-side" | "server-side" | false;

IPaginationProperties

interface IPaginationProperties {
  pageIndex?: number;
  pageSize?: number;
  showFirstButton?: boolean;
  showLastButton?: boolean;
  onSizeChange?: (pageSize: number) => void;
  onIndexChange?: (pageIndex: number) => void;
}

(WIP) INLINE EDIT MODE

make the rows editable inline