html-builders
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

Html builders

Simple helper library to build HtmlElements for engineers that know what they are doing.

It constructs html elements using simplified API with a dedicated functions for elements.

  • No compilation
  • No dependencies
  • No magic
  • Full typescript support

Format

createElement(tagName, { attributes }, ...children)

Or use can use helper class to create standard html elements

tagName({ attributes }, ...children)

Example

const element = div(
  { class: "my-div", style: { width: "400px", margin: "0 auto" }},
  p("Hello world!"),
  button({ class: "my-button" }, "Click me!")
);

document.appendChild(element);

Inspired by hyperscript-helpers.

License: MIT

Package Sidebar

Install

npm i html-builders

Weekly Downloads

0

Version

0.1.6

License

MIT

Unpacked Size

63.3 kB

Total Files

21

Last publish

Collaborators

  • mpazik