@yozora/react-table
TypeScript icon, indicating that this package has built-in type declarations

2.0.0-alpha.4 • Public • Published

@yozora/react-table


This component is for rendering the Table, TableRow, TableCell data produced by @yozora/tokenizer-table.
This component has been built into @yozora/react-markdown, you can use it directly.

Install

  • npm

    npm install --save @yozora/react-table
  • yarn

    yarn add @yozora/react-table

Usage

  • Basic:

    import React from 'react'
    import Table from '@yozora/react-table'
    import '@yozora/react-table/lib/esm/index.css'
    
    const ths: React.ReactNode[] = ['Name', 'Age']
    
    const tds: React.ReactNode[][] = [
      ['Alice', 18],
      ['Bob', 19],
    ]
    
    const wrapper = (
      <Table
        aligns={[ 'center', 'right' ]}
        ths={ths}
        tds={tds}
        style={{ color: 'orange', fontSize: '16px' }}
      />
    )

Props

Name Type Required Default Description
aligns `(string undefined)[]>` true -
ths React.ReactNode[] true - Table cells in thead
tds React.ReactNode[] true - Table cells in tbody
className string false - Root css class
style React.CSSProperties false - Root css style
  • aligns: Array<'left'|'center'|'right'|undefined>

  • className: The root element of this component will always bind with the CSS class 'yozora-table'.

Related

Package Sidebar

Install

npm i @yozora/react-table

Weekly Downloads

1

Version

2.0.0-alpha.4

License

MIT

Unpacked Size

13.9 kB

Total Files

8

Last publish

Collaborators

  • lemonclown