@ied/cell-table

1.0.0-beta.10 • Public • Published

CellTable

Install

yarn add @ied/cell-table

Use

import { CellTable, CellRow } from '@ied/cell-table'

const App = () => (
  <CellTable>
    <CellRow>
      <input />
      <input />
      <input />
      <input />
    </CellRow>
    <CellRow>
      <input />
      <input />
      <input />
      <input />
    </CellRow>
    <CellRow>
      <input />
      <input />
      <input />
      <input />
    </CellRow>
  </CellTable>
)

Use with exposed methode

import { CellTable, CellRow } from '@ied/cell-table'

class App extends React.Component {
  render () {
    <CellTable>
      {({ getNext }) => (
        <>
          <CellRow>
            <button onClick={() => getNext(this.input, 'ArrowRight')}>Go next<button>
            <input ref={elm => this.input = elm}/>
            <input />
            <input />
          </CellRow>
          <CellRow>
            <input />
            <input />
            <input />
            <input />
          </CellRow>
          <CellRow>
            <input />
            <input />
            <input />
            <input />
          </CellRow>
        </>
      )}
    </CellTable>
  }
}

To avoid some inputs during navigation

import { CellTable, CellRow } from '@ied/cell-table'

class App extends React.Component {
  render () {
    <CellTable>
      {({ getNext }) => (
        <>
          <CellRow>
            <input />
            <input className="ied-cell-table-avoid-el" tabIndex="-1" />
            <input />
          </CellRow>
          <CellRow>
            <input />
            <input />
            <input />
            <input />
          </CellRow>
          <CellRow>
            <input />
            <input />
            <input />
            <input />
          </CellRow>
        </>
      )}
    </CellTable>
  }
}

Types

type Props = {
  children: React$Node || ({getNext: (input:HTMLInputElement, action: Action) => void }) => React$Node,
  className?: string,
  style?: {},
}

enum Action = {
  "Enter"
  "ArrowRight"
  "Escape"
  "ArrowLeft"
  "ArrowDown"
  "ArrowUp"
}

Readme

Keywords

none

Package Sidebar

Install

npm i @ied/cell-table

Weekly Downloads

1

Version

1.0.0-beta.10

License

MIT

Unpacked Size

180 kB

Total Files

6

Last publish

Collaborators

  • vibbou
  • lfalorni