Socket
Socket
Sign inDemoInstall

gridjs-react

Package Overview
Dependencies
5
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gridjs-react

React component for Grid.js


Version published
Weekly downloads
4.6K
decreased by-12.5%
Maintainers
1
Install size
90.4 kB
Created
Weekly downloads
 

Readme

Source

Grid.js for React

React component for Grid.js

Install

npm install --save gridjs-react

Also, make sure you have Grid.js installed already as it's a peer dependency of gridjs-react:

npm install --save gridjs

Usage

Import the Grid component first:

import { Grid } from "gridjs-react";
<Grid
  data={[
    ['John', 'john@example.com'],
    ['Mike', 'mike@gmail.com']
  ]}
  columns={['Name', 'Email']}
  search={true}
  pagination={{
    enabled: true,
    limit: 1,
  }}
/>

Then you can pass all Grid.js configs to the Grid component. See Grid.js Config for more details.

React component in cells

You can bind your React components or elements in Table cells (both in header and body cells). Simply import the _ function and use it in data, columns or formatter function:

import { Grid, _ } from "gridjs-react";
<Grid
  data={[
    [
      _(<b>John</b>),
      'john@example.com',
    ],
    [
      _(<MyReactComponent>Mike</MyReactComponent>),
      'mike@gmail.com',
    ]
  ]}
  columns={[
    'Name', 
    {
      name: 'Email',
      formatter: (cell) => _(<i>{cell}</i>)
    }
  ]}
  search={true}
  pagination={{
    enabled: true,
    limit: 1,
  }}
/>

Example

See the React example on Grid.js website.

License

MIT

Keywords

FAQs

Last updated on 16 Jan 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc