react-sorted-table
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

sorted-table

A simple sortable table component.

NPM JavaScript Style Guide

Install

npm install --save react-sorted-table
# or 
yarn add react-sorted-table

Usage

import React from 'react'
import SortedTable from 'react-sorted-table'
import moment from 'moment'
 
const columns = [
  { id: 'name', label: 'Name', accessor: 'name' },
  { id: 'date', label: 'Date', accessor: item => moment(item.date).format('YYYY/MM/DD') },
  { id: 'quantity', label: 'Quantity', accessor: 'quantity' },
  { id: 'reference', label: 'Reference', accessor: 'reference' },
]
 
const data = [
  { _id: '0001', name: 'tomato', date: new Date(), quantity: 55, reference: '#AF34' },
  // ...
]
 
const Example = () => (
  <div>
    <SortedTable columns={columns} data={data} keyAccessor='_id' />
  </div>
)

License

MIT © hissalht

/react-sorted-table/

    Package Sidebar

    Install

    npm i react-sorted-table

    Weekly Downloads

    0

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    45.1 kB

    Total Files

    11

    Last publish

    Collaborators

    • hissalht