Coder Social home page Coder Social logo

ptzagk / reactabular Goto Github PK

View Code? Open in Web Editor NEW

This project forked from reactabular/reactabular

0.0 1.0 0.0 20.28 MB

Spectacular tables for React (MIT)

Home Page: http://reactabular.js.org/

License: MIT License

JavaScript 99.18% CSS 0.29% HTML 0.54%

reactabular's Introduction

Join the chat at https://gitter.im/reactabular/reactabular build status bitHound Score Dependency Status codecov

Reactabular - Spectacular tables for React

Reactabular has been designed to be extensible. Rather than implementing a lot of functionality in its core, it provides extension points. You can, for instance, customize rendering on cell level. It is possible to implement functionality, such as search, pagination, sorting, and inline editing, through composition. The library includes a variety of utilities for this even though you may use third party ones as well.

By default Reactabular operates using a column and a data definition. It doesn't care where those come from. It just renders the table for you. This means Reactabular will fit right into your current data architecture. It doesn't constrain it in any manner.

The chosen approach pushes a lot of complexity out of the core. As a result it might take more code to achieve certain functionalities. This is the price of flexibility. And that's the primary design goal of Reactabular.

If you want to learn more about React, read SurviveJS - Webpack and React.

Example

The following example illustrates the approach used by Reactabular:

const rows = [
  {
    id: 100,
    name: 'John',
    tools: {
      hammer: true
    },
    country: 'fi'
  },
  {
    id: 101,
    name: 'Jack',
    tools: {
      hammer: false
    },
    country: 'dk'
  }
];
const countries = {
  fi: 'Finland',
  dk: 'Denmark'
};

const columns = [
  {
    property: 'name',
    header: {
      label: 'Name',
      transforms: [
        label => ({
          onClick: () => alert(`clicked ${label}`)
        })
      ]
    }
  },
  {
    property: 'tools',
    header: {
      label: 'Active',
      transforms: [
        label => ({
          onClick: () => alert(`clicked ${label}`)
        })
      ]
    },
    cell: {
      format: tools => tools.hammer ? 'Hammertime' : 'nope'
    }
  },
  {
    property: 'country',
    header: {
      label: 'Country',
      transforms: [
        label => ({
          onClick: () => alert(`clicked ${label}`)
        })
      ]
    },
    cell: {
      format: country => countries[country]
    }
  },
];

<Table.Provider
  className="pure-table pure-table-striped"
  columns={columns}
>
  <Table.Header />

  <Table.Body rows={rows} rowKey="id" />
</Table.Provider>

Testimonials

If you've struggled with other React table components, you'll see why this one is the best! - Tim Dorr

If you are using Reactabular and want to endorse it, let me know.

Sponsors

SurviveJS Kenandy

License

MIT. See LICENSE for details.

reactabular's People

Contributors

bebraw avatar gaearon avatar eviltoylet avatar mrorz avatar nuragic avatar szdc avatar jmatsushita avatar skosch avatar goldensunliu avatar cdaringe avatar bjrmatos avatar daannijkamp avatar callahad avatar arkon avatar fredericheem avatar icarusmj12 avatar julen avatar koenpunt avatar alexkuz avatar mathieumg avatar gitter-badger avatar trun avatar hulufei avatar

Watchers

James Cloos 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.