npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gedrat-grid-table

v1.0.7

Published

css grid table html table less

Readme

GridTable Component

Super simple table less grid component that just works.

import React from 'react';
import { useState } from 'react'
import { IGridTable, IColumn, IGridTableStyles, FieldValues } from 'gedrat-grid-table';

//data interface
interface UserData  {
  name: string;
  age: number;
  email: string;
}

const data: UserData[] = [
  { name: 'Alice', age: 25, email: '[email protected]' },
  { name: 'Bob', age: 30, email: '[email protected]' },
]

//columns definition
const columns: IColumn<UserData>[] = [
  { name: 'name', align: 'left' },
  { name: 'age', align: 'center' },
  { name: 'email', align: 'right' },
]

//component usage
const UserDataGridTable = () => {
 const [selected, setSelected] = useState<MyData | undefined>()

  const handleSelect = (e: MyData) => {
    if (selected === e) {
      setSelected(undefined)
      return
    }
    setSelected(e)
  }

  return (   
      <GridTable
        data={data}
        columns={columns}
        selected={selected}
        handleSelect={handleSelect}
        sortable
        resizable
      />    
  )
}

export default UserDataGridTable;

Style example

:root {
  --gedrat-grid-bg-color: rgba(0, 0, 0, 0.178);
  --gedrat-grid-bg-zebra-color: rgba(9, 189, 90, 0.089);
  --gedrat-row-cell-border: solid 1px rgba(167, 160, 160, 0.07);
  --gedrat-grid-cells-space: 3px;
  --gedrat-grid-cells-radius: 7px;
}

.gedrat-grid-table {
  width: 100% !important;
  text-wrap: wrap;
  background-color: var(--gedrat-grid-bg-color);

  .gedrat-grid-row-cell {
    padding: var(--gedrat-grid-cells-space);
    border-top: var(--gedrat-row-cell-border);
    border-bottom: var(--gedrat-row-cell-border);
    margin-bottom: var(--gedrat-grid-cells-space);

    &.start-cell {
      border-left: var(--gedrat-row-cell-border);
      margin-left: var(--gedrat-grid-cells-space);
      border-radius: var(--gedrat-grid-cells-radius) 0 0
        var(--gedrat-grid-cells-radius);
    }

    &.end-cell {
      border-right: var(--gedrat-row-cell-border);
      border-radius: 0 var(--gedrat-grid-cells-radius)
        var(--gedrat-grid-cells-radius) 0;
      margin-right: var(--gedrat-grid-cells-space);
    }
  }

  .gedrat-grid-table-header {
    position: sticky;
    top: 0;
    z-index: 1;
    text-wrap: nowrap;
    background-color: var(--bs-dark-bg-subtle);

    padding: var(--gedrat-grid-cells-space);
    align-content: center;
    justify-content: center;
    text-align: center;

    &.start-cell {
      // background-color: red;
    }
    &.end-cell {
      // background-color: red;
    }
  }

  .zebra {
    background-color: var(--gedrat-grid-bg-zebra-color);
  }
}

Types

GridTable

The IGridTable interface defines the main table structure and includes properties for data, columns, styles, resizing, sorting, and fallback text.

export interface IGridTable<T extends FieldValues> {
  data: T[];
  columns: IColumn<T>[];  
  resizable?: boolean;
  sortable?: boolean;
  noDataText?: string;
}
  • data: An T array representing each row's data in the table.
  • columns: An array of columns defined by IColumn.
  • resizable (optional): Fit container to the rest of windows height.
  • sortable (optional): Enables data sorting.
  • noDataText (optional): Text to display when there’s no data in the table.

Columns

The IColumn interface defines the structure of an individual column in the table, including options for text alignment and custom components.

export interface IColumn<F extends FieldValues> {
  name: FieldName<F>;
  align?: 'left' | 'right' | 'center';
  
}

Properties:

  • name: Name of the field corresponding to the column data.
  • align (optional): Alignment of the column content ('left', 'right', or 'center').

Installation

To use this component, install it from npm:

npm install 

License

MIT License. See LICENSE file for more details.