more-component

Expand and collapse lists

more

Expand and collapse lists.

$ component install component/more
var more = require('more');
var list = document.querySelector('ul');
 
more(list)
  .max(5)
  .more('Show more')
  .less('Show less')
  .render();

Change max number of list items shown when collapsed, defaults to 5.

Change label from default of "More".

Change label from default of "Less".

Render the list, adds the appropriate more / less link depending on the state.

Expand the list and re-render.

Collapse the list and re-render.

String representing the state. Either "expanded", or "collapsed".

License

MIT