1.2.15 • Published 6 months ago

gadwal v1.2.15

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيمِ

Gadwal

Funny GIF

Basic React Table.

Features

  • Customizable columns
  • Supports custom rendering for each cell
  • Tailwind CSS support

Installation

npm install gadwal

Add styles to main.tsx

import "gadwal/dist/style.css"

Usage

Sample Data

const data = [
  {
    id: 1,
    name: "Leanne Graham",
    username: "Bret",
    email: "oqkz9@example.com",
    website: "hildegard.org",
    phone: "1-770-736-8031 x56442",
    company: {
      name: "Romaguera-Crona",
      catchPhrase: "Multi-layered client-server neural-net",
      bs: "harness real-time e-markets",
    },
  },
  {
    id: 2,
    name: "Ervin Howell",
    username: "Antonette",
    email: "vOy9C@example.com",
    website: "anastasia.net",
    phone: "010-692-6593 x09125",
    company: {
      name: "Deckow-Crist",
      catchPhrase: "Proactive didactic contingency",
      bs: "synergize scalable supply-chains",
    },
  },
];

Table Configuration

const table: TableRow[] = [
  { header: "id", name: "id", size: 2 },
  { header: "name", name: "name", size: 5 },
  { header: "email", name: "email", size: 5 },
  { header: "website", name: "website", size: 4 },
  { header: "phone", name: "phone", size: 4 },
  { header: "company", name: "company", size: 4, custom: (d) => d.company.name },
];

Component Usage

import React from 'react';
import Table from 'gadwal';

const data = [
  {
    id: 1,
    name: "Leanne Graham",
    username: "Bret",
    email: "oqkz9@example.com",
    website: "hildegard.org",
    phone: "1-770-736-8031 x56442",
    company: {
      name: "Romaguera-Crona",
      catchPhrase: "Multi-layered client-server neural-net",
      bs: "harness real-time e-markets",
    },
  },
  {
    id: 2,
    name: "Ervin Howell",
    username: "Antonette",
    email: "vOy9C@example.com",
    website: "anastasia.net",
    phone: "010-692-6593 x09125",
    company: {
      name: "Deckow-Crist",
      catchPhrase: "Proactive didactic contingency",
      bs: "synergize scalable supply-chains",
    },
  },
];

const table = [
  { header: "id", name: "id", size: 2 },
  { header: "name", name: "name", size: 5 },
  { header: "email", name: "email", size: 5 },
  { header: "website", name: "website", size: 4 },
  { header: "phone", name: "phone", size: 4 },
  { header: "company", name: "company", size: 4, custom: (d) => d.company.name },
];

function App() {
  return (
    <div className="flex w-full">
      <Table data={data} table={table} />
    </div>
  );
}

export default App;

props

propsusagerequireddefault
datatable data that is going to be rendredtrue-
tablecoulums of the table each represents a celltrue-
fixedHeightto force each table row to a fixed height (50px)falsetrue
animatedanimate table contentfalsefalse
strippedmake table rows strippedfalsetrue
bodyPropsto pass custom styles , classes , ...etc all div attributes to each row of datafalse{}
headerPropsto pass custom styles , classes , ...etc all div attributes to only table headfalse{}
bodyCellPropsto pass custom styles , classes , ...etc all div attributes to each row cells of datafalse{}
headerCellPropsto pass custom styles , classes , ...etc all div attributes to only table head cellsfalse{}

License

MIT

🚀 About Me

I'm a MERN stack developer...

Authors

Repository

Repository

Summary

﴾ ذَٰلِكَ فَضْلُ اللَّهِ يُؤْتِيهِ مَن يَشَاءُ ۚ وَاللَّهُ ذُو الْفَضْلِ الْعَظِيمِ﴿

1.2.14

6 months ago

1.2.15

6 months ago

1.2.13

8 months ago

1.2.12

12 months ago

1.2.10

12 months ago

1.2.11

12 months ago

1.2.9

12 months ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago