Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-table-lib

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-table-lib

React responsive table library

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

React Table

Installation

yarn add react-table-lib

Usage

import Table from 'react-table-lib'

  • Basic Table

    const data = [
      { name: "Earline Stokes", age: 30 },
      { name: "Amina Bergstrom", age: 25 },
      { name: "Kattie Hoppe", age: 20 }
    ]
    
    return (
      <Table data={data}>
    )
    
  • Column mapped

    const data = [
      { name: "Earline Stokes", age: 30 },
      { name: "Amina Bergstrom", age: 25 },
      { name: "Kattie Hoppe", age: 20 }
    ]
    
    const columns = {
      name: { label: "Full Name", sortable: true },
      age: { label: "Age", format: (data) => data + 'yrs' }
    }
    
    return (
      <Table data={data} columns={columns}>
    )
    
  • Selectable

    const data = [
      { name: "Earline Stokes", age: 30 },
      { name: "Amina Bergstrom", age: 25 },
      { name: "Kattie Hoppe", age: 20 }
    ]
    
    const columns = {
      name: { label: "Full Name", sortable: true },
      age: { label: "Age", format: (data) => data + 'yrs' }
    }
    
    const handleSelect = (data) => {
      // do something
      // data [{ name: "Earline Stokes", age: 30 }]
    }
    
    return (
      <Table data={data} columns={columns} selectable="multiple" onSelect={handleSelect}>
    )
    

Table Properties

Props/MethodsDefaultTypeRequiredDetails
data-arraytrueTable Records in array format with each entry holding key : value pair
columns{}objectfalseEach property for data's entry's header property
Ref: Columns
selectable-'single'
'multiple'
falseSelectable option to select table record based on type single or multiple
onSelect-functionfalseCallback to get selected records details.
callback data: record (or) array of records

Columns Properties

PropertytypeDetails
labelstringTable Header column name
sortablebooleanColumn sortable property
formatfunctionFormatting table record for the same column

Demo

Code Sandbox

Note: Please run yarn storybook to see demo. You can run this in your local too to check the same

FAQs

Package last updated on 18 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc