Skip to content

Html helper functions for Hyperapp.

License

Notifications You must be signed in to change notification settings

cjh9/html

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@hyperapp/html

Travis CI Codecov npm Slack

Html helper functions for Hyperapp. Use as an alternative to the built-in h() function.

Installation

Install with npm or Yarn.

npm i @hyperapp/html

Then with a module bundler like Rollup or Webpack, use as you would anything else.

import { h1, div, a } from "@hyperapp/html"

Or download directly from unpkg or jsDelivr.

<script src="https://unpkg.com/@hyperapp/html"></script>

The find the library in window.html.

const { h1, div, a } = html

Usage

const node = h1({ id: "title" }, "Hi.")

Example

Try it Online

app({
  state: {
    count: 0
  },
  view: (state, actions) =>
    main([
      h1({}, state.count),
      button({
        onclick: actions.down,
        disabled: state.count <= 0
      }, "—"),
      button({
        onclick: actions.up
      }, "+")
    ]),
  actions: {
    down: state => ({ count: state.count - 1 }),
    up: state => ({ count: state.count + 1 })
  }
})

License

@hyperapp/html is MIT licensed. See LICENSE.

About

Html helper functions for Hyperapp.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%