-
-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
404 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,49 @@ | ||
[![npm version](https://badge.fury.io/js/react-data-table-component.svg)](https://badge.fury.io/js/react-data-table-component) [![codecov](https://codecov.io/gh/jbetancur/react-data-table-component/branch/master/graph/badge.svg)](https://codecov.io/gh/jbetancur/react-data-table-component) | ||
[![Netlify Status](https://api.netlify.com/api/v1/badges/26e0d16d-a986-46b1-9097-1a76c10d7cad/deploy-status)](https://app.netlify.com/sites/react-data-table-component/deploys) [![npm version](https://badge.fury.io/js/react-data-table-component.svg)](https://badge.fury.io/js/react-data-table-component) [![codecov](https://codecov.io/gh/jbetancur/react-data-table-component/branch/master/graph/badge.svg)](https://codecov.io/gh/jbetancur/react-data-table-component) | ||
|
||
## Documentation Website | ||
|
||
# React Data Table Component | ||
|
||
[![GitHub release](https://img.shields.io/github/release/jbetancur/react-data-table-component.svg)](https://GitHub.com/jbetancur/react-data-table-component/releases/) | ||
|
||
Creating yet another React table library came out of necessity while developing a web application for a growing startup. I discovered that while there are some great table libraries out there, some required heavy customization, were missing out of the box features such as built in sorting and pagination, or required understanding the atomic structure of html tables. | ||
|
||
If you want to achieve balance with the force and want a simple but flexible table library give React Data Table Component a chance. If you require an Excel clone, then this is not the React table library you are looking for 👋 | ||
|
||
# Key Features | ||
|
||
- Declarative configuration | ||
- Built-in and configurable: | ||
- Sorting | ||
- Selectable Rows | ||
- Expandable Rows | ||
- Pagination | ||
- Themeable/Customizable | ||
- Accessibility | ||
- Responsive (via x-scroll/flex) | ||
|
||
# Documentation Website | ||
|
||
[![Netlify Status](https://api.netlify.com/api/v1/badges/26e0d16d-a986-46b1-9097-1a76c10d7cad/deploy-status)](https://app.netlify.com/sites/react-data-table-component/deploys) | ||
|
||
The documentation contains information about installation and usage. | ||
The documentation contains information about installation, usage and contributions. | ||
|
||
https://react-data-table-component.netlify.app | ||
|
||
## UI Library Integration | ||
# Supporting React Data Table Component | ||
|
||
React Data Table Component makes it easy to incorporate ui components from other libraries for overriding things like the sort icon, select checkbox. | ||
If you would like to support the project financially, visit | ||
[our campaign on OpenCollective](https://opencollective.com/react-data-table-component). Your contributions help accelerate the development of React Data Table Component! | ||
|
||
- [MaterialUI](https://codesandbox.io/s/react-data-table-materialui-72gdo) | ||
- [Bootstrap 4](https://codesandbox.io/s/react-data-table-sandbox-z6gtg) | ||
<a href="https://opencollective.com/react-data-table-component" target="_blank"> | ||
<img src="https://opencollective.com/react-data-table-component/contribute/button@2x.png?color=blue" width="250px" /> | ||
</a> | ||
|
||
# Contributors | ||
|
||
Thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. | ||
<a href="https://github.com/jbetancur/react-data-table-component/graphs/contributors"><img src="https://opencollective.com/react-data-table-component/contributors.svg?width=890" /></a> | ||
<a href="https://github.com/jbetancur/react-data-table-component/graphs/contributors"> | ||
<img src="https://opencollective.com/react-data-table-component/contributors.svg?width=890" /> | ||
</a> | ||
|
||
# Stargazers over time | ||
|
||
[![Stargazers over time](https://starchart.cc/jbetancur/react-data-table-component.svg)](https://starchart.cc/jbetancur/react-data-table-component) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Story, Canvas } from '@storybook/addon-docs'; | ||
|
||
# Expandable Rows | ||
|
||
Adding Expandable Rows functionality is easy. Let's make our rows expandable: | ||
|
||
```js | ||
function MyComponent() { | ||
return ( | ||
<DataTable | ||
columns={columns} | ||
data={data} | ||
expandableRows | ||
/> | ||
); | ||
}; | ||
``` | ||
|
||
## Custom Expander component | ||
Next, we'll need to create a custom component to display our data and pass it into `DataTable`: | ||
|
||
```js | ||
// data provides access to your row data | ||
const ExpandedComponent = ({ data }) => <pre>{JSON.stringify(data, null, 2)}</pre>; | ||
|
||
function MyComponent() { | ||
return ( | ||
<DataTable | ||
columns={columns} | ||
data={data} | ||
expandableRows | ||
expandableRowsComponent={ExpandedComponent} | ||
/> | ||
); | ||
}; | ||
``` | ||
|
||
You'll notice that `expandableRowsComponent` has a function signtaure of `({ data }) => ...`. React Data Table handles passing your row `data` into your custom expandable component so you can access that rows fields. | ||
|
||
<Canvas> | ||
<Story id="expandable-basic--basic" /> | ||
</Canvas> | ||
|
||
## Accessibility | ||
|
||
You can tab through expanders and use the space bar or enter keys to expand. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Story, Canvas } from '@storybook/addon-docs'; | ||
|
||
# Pre Disabled Rows | ||
|
||
To pre-disable rows based on your data: | ||
|
||
```js | ||
... | ||
const rowPreDisabled = row => row.disabled; | ||
|
||
function MyComponent() { | ||
return ( | ||
<DataTable | ||
columns={columns} | ||
data={data} | ||
expandableRows | ||
expandableRowDisabled={rowPreDisabled} | ||
/> | ||
); | ||
} | ||
``` | ||
|
||
<Canvas> | ||
<Story id="expandable-pre-disabled--pre-disabled" /> | ||
</Canvas> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Story, Canvas } from '@storybook/addon-docs'; | ||
|
||
# Pre Selected Rows | ||
|
||
To pre-select rows based on your data: | ||
|
||
```js | ||
... | ||
const rowPreExpanded = row => row.defaultExpanded | ||
|
||
function MyComponent() { | ||
return ( | ||
<DataTable | ||
columns={columns} | ||
data={data} | ||
expandableRows | ||
expandableRowExpanded={rowPreExpanded} | ||
/> | ||
); | ||
} | ||
``` | ||
|
||
<Canvas> | ||
<Story id="expandable-pre-expanded--pre-expanded" /> | ||
</Canvas> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.