Skip to content

Latest commit

 

History

History
29 lines (19 loc) · 616 Bytes

File metadata and controls

29 lines (19 loc) · 616 Bytes

h

install

pnpm add -D @itsy/h

use

import { h } from '@itsy/h'

h('h1', { class: 'omg' }, 'Hello world!')

api

The h function can take two or three primary arguments. In the three-argument form, an options-object is also available.

  • tag: The HTML tag to create
  • attrs: An object of HTML attributes - e.g. { id: 'foo' } would create id="foo"
  • children: A string or array of strings containing child-content for the parent
  • opts: An options-object
    • opts.escape: Will HTML-escape children

h(tag, attrs | children)

h(tag, attrs, children, opts?)