# domb

> DOM Builder, a simple cross-platform DOM generation library

Latest version **0.2.1** (published 2022-06-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install domb
pnpm add domb
yarn add domb
bun add domb
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2022-06-01 |
| First published | 2022-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 20.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Vyacheslav Aristov |
| Maintainers | aristov |
| Keywords | html, dom, dom builder, dom assembler, dom node, dom element, element node, text node, document fragment, template, template engine |

## Links

- npm: https://www.npmjs.com/package/domb
- Repository: https://github.com/aristov/domb
- Homepage: https://github.com/aristov/domb#readme
- Issues: https://github.com/aristov/domb/issues
- npm.io page: https://npm.io/package/domb

## Dependencies (1)

- [xwindow](https://npm.io/package/xwindow.md) ^0.1.1

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 0.2.1 (latest) — 2022-06-01
- 0.2.0 — 2022-06-01
- 0.1.5 — 2022-06-01
- 0.1.4 — 2022-05-26
- 0.1.3 — 2022-05-18
- 0.1.2 — 2022-05-17
- 0.1.1 — 2022-05-17
- 0.1.0 — 2022-05-17

## README

# domb

[![NPM Version](https://img.shields.io/npm/v/domb.svg)](https://www.npmjs.com/package/domb)
[![Node.js CI](https://github.com/aristov/domb/actions/workflows/node.js.yml/badge.svg)](https://github.com/aristov/domb/actions/workflows/node.js.yml)
[![Coverage Status](https://coveralls.io/repos/github/aristov/domb/badge.svg?branch=main)](https://coveralls.io/github/aristov/domb?branch=main)
[![NPM](https://img.shields.io/npm/l/domb)](https://raw.githubusercontent.com/aristov/domb/main/LICENSE)

DomB [domby] is a DOM Builder.

This is a simple cross-platform DOM generation library.
It is a handy tool for creating templates and testing.

## Features

- Convenient JS-compatible syntax
- Cross-platform, works both in NodeJS and in the browser
- Support for ES2015 named imports
- Small footprint, 1KB after gzip

## Installation

```shell
npm install domb
```

## Usage

ES2015

```js
import { div } from 'domb'
```

CommonJS

```js
const { div } = require('domb')
```

Browser

```html
<script src="https://unpkg.com/domb@latest/dist/domb.js"></script>
<script>
  const { div } = domb
</script>
```

## Example

DomB can be used both in NodeJS and in the browser:

```js
import { form, label, input, button } from 'domb'

const node = form({
  action : 'https://google.com/search',
  target : '_blank',
  children : [
    label([
      'Search ',
      input({ type : 'search', name : 'q' }),
    ]),
    button('Find'),
  ],
})

// browser
document.body.append(node)

// nodejs
app.get('/form', (req, res) => res.send(node.outerHTML))
```

The `node` variable is a DOM structure with the appropriate markup:

```html
<form action=//google.com/search target=_blank>
    <label>
        Search 
        <input type=search name=q>
    </label>
    <button>Find</button>
</form>
```

## License

[The MIT License (MIT)](https://raw.githubusercontent.com/aristov/domb/master/LICENSE)

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