div(
{ class: "table-responsive" },
table(
{ class: ["table table-sm", opts.onRowSelect && "table-hover"] },
thead(tr(hdrs.map(hdr => headerCell(hdr)))),
tbody(
vs.map(v =>
tr(
mkClickHandler(opts, v),
hdrs.map(hdr =>
td(typeof hdr.key === "string" ? text(v[hdr.key]) : hdr.key(v))
)
)
)
)
)
The first argument to a tag is optionally an object with the attributes, any subsequent arguments are children of the tag, or an array with the children.EDIT:
the library as a gist: https://gist.github.com/glutamate/69d38fb1d2024cb829edfff57d...