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

react-keyview

v1.0.0

Published

React components to display the list, table, and grid, without scrolling, use the keyboard keys to navigate through the data

Downloads

2

Readme

react-keyview


Installation


via NPM

npm i react-keyview

via Yarn

yarn add react-keyview

via CDN (unpkg)

https://unpkg.com/react-keyview@latest

UMD library exposed as ReactKeyView

const KV = ReactKV;

Note. This package does not provide any stylesheet resources, the components are highly customizable. It is also supports Server-side rendering

Demos

Usage

You can import any component you want as a named export from 'react-keyview', eg.

import { Grid, Table } from "react-keyview";

Or you can directly import only the components you need, like so.

import Grid from "react-keyview/build/Grid";
import Table from "react-keyview/build/Table";

UMD modules has prefix ReactKV, eg.

const Grid = ReactKVGrid;
const List = ReactKVList;

List


function renderRow(rowIndex, currentIndex) {
  return <div>{rowIndex}</div>;
}

<List renderRow={this.renderRow} count={YOUR_DATA.length} visibleCount={5} rowHeight={50} />;

| Prop | Type | Description | | ------------ | :------: | ---------------------------------: | | renderRow | Function | Renders a single row | | count | Number | Number of elements | | rowHeight | Number | Row height | | visibleCount | Number | The visible elements count | | dom | Object | Pass attributes to an HTML element |

Table


function renderHeader(item) {
  return item;
}
function renderRowColumn(i, j) {
  var getRowColumn = DATA[i][header[j]];
  return <td key={UNIQUE_KEY}>{getRowColumn}</td>;
}

function renderRow(rowIndex, currentIndex, col) {
  return <tr key={UNIQUE_KEY}>{col}</tr>;
}

<Table
  header={header}
  renderHeader={this.renderHeader}
  renderRow={this.renderRow}
  columnCount={3}
  count={YOUR_DATA.length}
  visibleCount={5}
  rowHeight={50}
  renderRowColumn={this.renderRowColumn}
/>;

| Prop | Type | Description | | --------------- | :------: | ---------------------------------: | | visibleCount | Number | Number of visible rows | | count | Number | Number of rows | | header | Array | Must be an array of strings | | renderHeader | Function | Number of visible columns | | renderRow | Function | Renders row | | renderRowColumn | Function | Renders the columns of the row | | dom | Object | Pass attributes to an HTML element |

Grid


function renderer({ rowIndex, columnIndex, yIndex, xIndex }) {
  return (
    <td key={UNIQUE_KEY}>
      Item {columnIndex},{rowIndex}
    </td>
  );
}

<Grid
  renderer={this.renderer}
  visibleRows={6}
  rowCount={100}
  rowWidth={30}
  columnCount={100}
  visibleColumns={6}
  columnHeight={50}
/>;

| Prop | Type | Description | | -------------- | :------: | ---------------------------------: | | columnCount | Number | Number of columns | | visibleColumns | Number | Number of visible columns | | rowCount | Number | Number of lines | | visibleRows | Number | Number of visible rows | | renderer | Function | Displays the row and column | | dom | Object | Pass attributes to an HTML element |