Responsive table library in ES6
npm install responsive-tableMost front end projects involving tables require
some sort of responsive behavior, and not all of it
the same. Responsive table aims to be a hyper flexible
front end library for dealing with responsive tables.
It comes in three modules and is written in vanilla ES6.
- element : table wrapper element
- breakPoint: number of pixels wide to switch to mobile view
- mobileCallback: function to substitute the default mobile view
- desktopCallback: function to substitute the default desktop view
``javascript
import ResponsiveTable from '../src/responsive_table';
let breakPoint = 800,
element = document.getElementById('better-table'),
new ResponsiveTable.TableComponentController({
breakPoint: breakPoint,
element: element
});
`
`html`
header 1
header 2
header 3
data 1
data 2
data 3
data 1
data 2
data 3
data 1
data 2
data 3
foot 1
foot 2
foot 3
- cards(element) : returns and sets the transformed markup for card formattingcached(element, cached)
- : returns and sets the cached markup
`javascript
import ResponsiveTable from 'responsive-table';
let tableElement = document.getElementById('responsive-table');
ResponsiveTable.TableComponentViews.cards(tableElement);
`
- width() : Returns the width of your screen at any given pointheight()
- : Returns the height of your screen at any given point
`javascript
import ResponsiveTable from 'responsive-table';
ResponsiveTable.ScreenCalulator.width(); // Your current width
ResponsiveTable.ScreenCalulator.height(); // Your current height
``