# hyper-dom-expressions

> A Fine-Grained Rendering Runtime API using HyperScript

Latest version **0.40.14** (published 2026-11-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install hyper-dom-expressions
pnpm add hyper-dom-expressions
yarn add hyper-dom-expressions
bun add hyper-dom-expressions
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.40.14 |
| Published | 2026-11-10 |
| First published | 2019-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1018 |
| Author | Ryan Carniato |
| Maintainers | ryansolid |

## Links

- npm: https://www.npmjs.com/package/hyper-dom-expressions
- Repository: https://github.com/ryansolid/dom-expressions/blob/main/packages/hyper-dom-expressions
- npm.io page: https://npm.io/package/hyper-dom-expressions

## Recent versions

- 0.40.14 (latest) — 2026-11-10
- 0.50.0-next.14 (next) — 2026-06-13
- 0.37.0-beta.4 (beta) — 2023-10-09
- 0.40.13 — 2026-10-29
- 0.40.12 — 2026-10-07
- 0.40.11 — 2026-10-06
- 0.40.10 — 2026-08-17
- 0.50.0-next.13 — 2026-05-18
- 0.40.8 — 2026-05-15
- 0.50.0-next.12 — 2026-05-14
- 0.40.7 — 2026-05-14
- 0.50.0-next.11 — 2026-05-13
- 0.50.0-next.10 — 2026-05-12
- 0.50.0-next.9 — 2026-05-11
- 0.50.0-next.8 — 2026-05-11
- … 426 more at https://npm.io/package/hyper-dom-expressions/versions

## README

# Hyper DOM Expressions

[![Build Status](https://github.com/ryansolid/dom-expressions/workflows/DOMExpressions%20CI/badge.svg)](https://github.com/ryansolid/dom-expressions/actions/workflows/main-ci.yml)
[![NPM Version](https://img.shields.io/npm/v/hyper-dom-expressions.svg?style=flat)](https://www.npmjs.com/package/hyper-dom-expressions)
![](https://img.shields.io/bundlephobia/minzip/hyper-dom-expressions.svg?style=flat)
![](https://img.shields.io/npm/dt/hyper-dom-expressions.svg?style=flat)

This package is a Runtime API built for [DOM Expressions](https://github.com/ryansolid/dom-expressions) to provide HyperScript DSL for reactive libraries that do fine grained change detection. While the JSX plugin [Babel Plugin JSX DOM Expressions](https://github.com/ryansolid/dom-expressions/blob/main/packages/babel-plugin-jsx-dom-expressions) is more optimized with precompilation, smaller size, and cleaner syntax, this HyperScript solution has the flexibility of not being precompiled. However, Tagged Template Literals are likely a better choice in terms of performance in non-compiled environments [Lit DOM Expressions](https://github.com/ryansolid/dom-expressions/blob/main/packages/lit-dom-expressions).

## Compatible Libraries
* [Solid](https://github.com/ryansolid/solid): A declarative JavaScript library for building user interfaces.
* [ko-jsx](https://github.com/ryansolid/ko-jsx): Knockout JS with JSX rendering.
* [mobx-jsx](https://github.com/ryansolid/mobx-jsx): Ever wondered how much more performant MobX is without React? A lot.

## Getting Started

Install alongside the DOM Expressions and the fine grained library of your choice. For example with S.js:

```sh
> npm install s-js dom-expressions hyper-dom-expressions
```
Create your configuration and run dom-expressions command to generate runtime.js. More info [here](https://github.com/ryansolid/dom-expressions).

Use it to initialize your Hyper function
```js
import { createHyperScript } from 'hyper-dom-expressions';
import * as r from './runtime';

const h = createHyperScript(r);
```

Profit:
```js
const view = h('table.table.table-hover.table-striped.test-data',
  h('tbody', mapSample(() => state.data, row =>
    h('tr', [
      h('td.col-md-1', row.id),
      h('td.col-md-4', h('a', {onClick: [select, row.id]}, () => row.label)),
      h('td.col-md-1', h('a', {onClick: [remove, row.id]}, h('span.glyphicon.glyphicon-remove'))),
      h('td.col-md-6')
    ])
  ))
));

S.root(() => r.insert(document.getElementById('main'), view());)
```

Libraries may expose access to h in different ways. For example Solid has it's own entry point 'solid-js/h'.

## Differences from JSX

There are also several small differences but generally follows HyperScript conventions. Ref work by passing a function. Keep in mind you need to wrap expressions in functions if you want them to be observed. For attributes since wrapping in a function is the only indicator of reactivity, passing a non-event function as a value requires wrapping it in a function.

Fragments are just arrays. Components are handled by passing a Function to the first argument of the h function. Ie:
```jsx
const view = <>
  <Component prop={value} />
  {someValue()}
</>

// is equivalent to:
const view = [
  h(Component, {prop: value}),
  () => someValue()
]
```

## Status

I'm still working out API details and performance profiling.

---
_Source: https://npm.io/package/hyper-dom-expressions · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
