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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@talkohavy/table

v0.0.17

Published

The most simple Table implementation in the world, that fits 90% of your use-cases.

Downloads

8

Readme

@talkohavy/table

The most simple Table implementation in the world, that fits 90% of your use-cases.

1. Supported Features

  1. Row Virtualization
  2. Row selection (Multi & Single)
  3. Sticky Headers
  4. Sorting (including multi-sort)
  5. Column Resizing
  6. Group Headers
  7. Pagination
  8. Infinite scroll
  9. onRowClick event
  10. Load more data when reaching bottom
  11. ⭐️Highly customizable⭐️ with custom css hooks for personal styling

2. List of known problems

  1. Double-render. For some reason, row selection has to be a dependency for when calculating columnDefs in order for selected rows which were checked using the checkbox to appear as such in the next render. In the example shown in @tanstack/table it seemed like that isn't necessary. Need to check.
  2. Table Width. Now that Column-Sizing is a built-in feature, need to figure out the best way to handle table width, and how to make it take up the full size of its container. Right now, we've given our users the ability to manually switch between 100% width, and auto width, using a props called isFullSize, but that might be changed soon.

3. Getting Started

install the package:

npm install @talkohavy/table

import and use the Table component like so:

import { Table } from '@talkohavy/table';

export const data = [
  {
    id: 1,
    first_name: 'Emlen',
    last_name: 'Orth',
    email: '[email protected]',
    gender: 'Female',
    ip_address: '163.228.179.208',
  },
  {
    id: 2,
    first_name: 'Conrad',
    last_name: 'Liepmann',
    email: '[email protected]',
    gender: 'Male',
    ip_address: '225.98.191.215',
  },
  {
    id: 3,
    first_name: 'Magnum',
    last_name: 'Le Brom',
    email: '[email protected]',
    gender: 'Male',
    ip_address: '170.255.125.199',
  },
  {
    id: 4,
    first_name: 'Bette',
    last_name: 'Wroughton',
    email: '[email protected]',
    gender: 'Female',
    ip_address: '169.143.132.230',
  },
];

export default function App() {
  return (
    <div style={{ width: '100%' }}>
      <Table data={data} />
    </div>
  );
}

That's it 🙂

Now, since Table is essentially a wrapper around @tanstack/table, you can pass columnDefs to it as you normally would:

import { Table } from '@talkohavy/table';
import { createColumnHelper } from '@tanstack/react-table';

const columnHelper = createColumnHelper<any>();

const columnDefs = [
  columnHelper.accessor('id', { header: 'ID' }),
  columnHelper.accessor('first_name', { header: 'First Name', enableSorting: true }),
  columnHelper.accessor('last_name', { header: 'Last Name' }),
  columnHelper.accessor('email', { header: 'Email' }),
  columnHelper.accessor('gender', { header: 'Gender' }),
  columnHelper.accessor('ip_address', { header: 'IP Address' }),
];

export const data = [/* ... data here ...*/];

export default function App() {
  return (
    <div style={{ width: '100%' }}>
      <Table data={data} columnDefs={columnDefs} />
    </div>
  );
}

Play around and have fun exploring 🧡

4. Table Options

Here's a list of all supported options:

  1. data type: Array<T>

    The only mandatory prop which Table requires.

  2. columnDef type: ColumnDef

    Exactly what you know about ColumnDef from @tanstack/table.

  3. showFooter type: boolean

    * Will be explained in the future *

  4. rowSelectionMode type: string Options: 'none' | 'single' | 'multi'

    * Will be explained in the future *

  5. isFullSize type: boolean

    * Will be explained in the future *

  6. searchText type: string

    Goes together with setSearchText.
    The data passed to Table will be filtered by rows that include searchText.
    * Will be explained in the future *

  7. setSearchText type: (value: any) => void

    Goes together with searchText.

    * Will be explained in the future *

  8. defaultColumn type: Partial<ColumnDef<TData, unknown>>

    * Will be explained in the future *

  9. customTableFooter type: React Component

    * Will be explained in the future *

  10. initialPageSize type: number

    * Will be explained in the future *