pnpm add -D @itsy/h
import { h } from '@itsy/h'
h('h1', { class: 'omg' }, 'Hello world!')
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 createattrs
: An object of HTML attributes - e.g.{ id: 'foo' }
would createid="foo"
children
: A string or array of strings containing child-content for the parentopts
: An options-objectopts.escape
: Will HTML-escapechildren