Skip to content

zvakanaka/table-of-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table Custom Element

Published on webcomponents.org
demo

About

Lightweight and easy to use data table

Usage

Import the element in the head

<script src="./table-of-data.js">

Put the element somewhere in the body

<table-of-data></table-of-data>

Put data in the table

let data = {
  headings: [ 'State', 'Place' ],
  rows: [
    [ 'California',
      'Redwood Forest'
    ],
    [ 'New York',
      'New York Islands'
    ]
  ]
};
document.querySelector('table-of-data').data = data;

Screenshot

Polyfill

Only Custom Elements needs to be polyfilled (custom-elements.js). To see how to use a polyfill, check out index.html, which only loads the polyfill if needed (credit to Eric Bidelman).