Highly customizable table library build on react.
- Customizable UI
- Custom Cell and Header Rendering
- Resizable (column width)
- Tooltip
- Pagination
- Loader
- Sorting
- Data Formatters (Value truncator, Currency value formatter, etc.)
- Custom Data Formatters
- Customizable No-Records message
-
className -
string -
style -
objectDefine the custom style.
style: { { width: '100%' } }
-
columns -
array(required)-
key -
string(required)Unique value associated with each column.
-
headerRender -
string(required)Header title.
Example:
headerRender: 'First Name' -
width -
stringWidth of the column (in
pxor%).Example:
width: '200px' -
headerStyle -
objectUsing this prop you can style each header by passing the CSS property inside
headerStyle.Example:
headerStyle: { fontWeight: 'bold', backgroundColor: 'grey' }
-
columnStyle -
objectUsing this prop you can style each column by passing the CSS property inside
columnStyle.Example:
columnStyle: { fontWeight: 'bold', backgroundColor: 'grey' }
-
cellRender -
functionorcomponentUsing this prop you can define a custom cell rending logic.
cellRenderexpose 5 arguments in the following order:-
value: Cell value
-
rowData: Row data
-
data: Entite Data Array
-
columnKey: Column unique key
-
index: Index value of the row
cellRender: ((val, rowData, data, columnKey, index)) => { // do something here })
Example:
cellRender: (val) => (val === 'Male' ? 'M' : 'F') // or cellRender: (val) => { return <MyCustomCellComponent value={val} /> }
-
-
cellTooltipRender -
booleanorfunctionorcomponentUsing the prop you can enable default tooltip or even define a custom tooltip component for the cell.
You can enable default tooltip on cell.
cellTooltipRender: trueYou can define a custom tooltip component.
cellTooltipRender: (val, rowData, data, columnKey, index) => { return <div>This is a custom tooltip</div> }
-
cellTooltipPosition -
stringYou can define the position of the tooltip of cell, if
cellTooltipRenderis enabled. Posibile value:top,bottom,leftandright.Example:
cellTooltipPosition: 'top' -
headerTooltipRender -
booleanorfunctionorcomponentUsing the prop you can enable default tooltip or even define a custom tooltip component for the cell.
You can enable default tooltip on cell.
headerTooltipRender: trueYou can define a custom tooltip component.
headerTooltipRender: (val) => { return <div>This is a custom tooltip</div> }
-
headerTooltipPosition -
stringYou can define the position of the tooltip of cell, if
headerTooltipRenderis enabled. Posibile value:top,bottom,leftandright.Example:
headerTooltipPosition: 'top'
-
-
data -
array(required) -
options -
object-
defaultSort -
objectYou can define the default sorting. By default sort is disabled. This can be defined using the below properties.
-
sortField -
stringThe field name which you want to sort.
sortField: 'first_name' -
sortOrder -
stringOrder of the sort -
ascfor ascending anddescfor descending. Default value isasc.sortOrder: 'desc' -
sortType -
stringDefine the type of sort. Column value will be sorted based on the type (
string,numberordate). Default value isstring.sortOrder: 'string'
-
-
defaultLoader -
object or booleanTo enable the default loader.
defaultLoadercan be enabled by passing in the boolean value (true) or by defining any object with the below properties. By default loader is disabled.defaultLoader: true // or defaultLoader: { }
Below are some of the properties that can be passed inside
defaultLoader-
loaderTimeout -
numberTime out (time in milli-seconds) to stop/hide loader. Default value is
3000.defaultLoader: { loaderTimeout: 5000 }
-
-
-
subComponents -
objectDefine the custom sub-components. Below are list of sub-components supported by versatile-table.
-
HeaderCellComponent
Custom header components.
subComponents={{ HeaderCellComponent: CustomHeaderCellComponent }}
-
NoRecordComponent
Custom NoRecord (if no record are found) components.
subComponents={{ NoRecordComponent: CustomNoRecordMessageComponent }}
-
PaginationComponent
Custom pagination components.
subComponents={{ PaginationComponent: CustomPaginationComponent }}
-
LoaderComponent
Custom Loader components.
subComponents={{ LoaderComponent: CustomLoaderComponent }}
-
-
Base development branch -
develop. -
If you are new contributor, Firstly create a copy of
developbranch for your development purpose. -
Do not commit any changes directly to
developandmasterbranch. -
Always raise a PR for the new changes to
developbranch and also add reviewer. -
Always pull the latest code (
git pull origin develop) and runnpm ibefore starting the your development work. -
Before committing the code, make sure no lint error are present in your code and also run
npm run formatto beautify the code.
-
Run
npm ito install dependencies. -
Run
npm run startto start the application. -
Application can be accessed on port 3000 -
http://localhost:3000/