# cydon

> A lightweight library for building fast, reactive web components.

Latest version **0.2.0** (published 2026-10-05) · MIT license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2026-10-05 |
| First published | 2023-04-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 30.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | 0-v-0 <kduice@qq.com> |
| Maintainers | 0-v-0 |
| Keywords | cydon, directives, progressive, progressive enhancement, reactive, templating |

## Links

- npm: https://www.npmjs.com/package/cydon
- Repository: https://github.com/0-v-0/cydon
- Homepage: https://0-v-0.github.io/cydon
- npm.io page: https://npm.io/package/cydon

## Recent versions

- 0.2.0 (latest) — 2026-10-05
- 0.1.9 — 2024-03-11
- 0.1.8 — 2023-12-10
- 0.1.7 — 2023-04-26
- 0.1.6 — 2023-04-17
- 0.1.5 — 2023-04-16
- 0.1.4 — 2023-04-14
- 0.1.3 — 2023-04-11

## README

# Cydon

[![npm-v](https://img.shields.io/npm/v/cydon.svg)](https://npmjs.com/package/cydon)
[![npm-d](https://img.shields.io/npm/dt/cydon.svg)](https://npmjs.com/package/cydon)
[![brotli](http://img.badgesize.io/https://unpkg.com/cydon/dist/cydon.iife.js?compression=brotli&label=brotli)](https://bundlephobia.com/result?p=cydon)

A lightweight library for building fast, reactive web components.

## Features
- No dependencies
- No virtual DOM, components are just DOM elements
- Performant and ultra-lightweight: ~3kB minified & brotli'd
- Intuitive and WYSIWYG: use HTML-based template syntax
- Simple: only provide minimalistic API required to implement reactivity of web components

## Preview
HTML:
```html
<my-pagination page="1">
    <template shadowrootmode="open">
        <style>
            button {
                padding: 0.3em;
            }
            .wrapper {
                display: flex;
                align-items: center;
            }
        </style>
        <!-- Watch callback -->
        <div class="wrapper" :="console.log('page No. is', page)">
            <!-- Event binding -->
            <button @click="page--">Prev</button>
            <!-- Two-way binding -->
            <select c-model="perPage" title="items per page">
                <template c-for="n; perPages">
                    <!-- DOM prop binding, attr binding and text interpolation -->
                    <option .selected="perPage == n" value="$n">$n</option>
                </template>
            </select>
            <span>
                per page
                <!-- text interpolation using expressions -->
                ${(page-1)*perPage+!!total}-${Math.min(page*perPage,total)} / $total
            </span>
            <button @click="page++">Next</button>
        </div>
    </template>
</my-pagination>
```
TypeScript:
```ts
import { CydonElement, define } from 'cydon'

@define('my-pagination')
export class MyPagination extends CydonElement {
	static observedAttributes = ['page']

	perPages = [5, 10, 20, 50]
	perPage = 10
	page = 1
	total = 42

	attributeChangedCallback(name: string, _oldVal: string, newVal: string) {
		if (name == 'page')
			this.page = +newVal
	}
}
```

## Directives
- Builtin directives: `c-for`, `ref`, etc.
- Extra directives: `c-model`, `c-if`, `c-show`, `c-cloak`, `c-tp`
- Event Modifiers: `.once`, `.passive`, `.capture`, `.away`
- Custom directives, including global and local directives

## Documentation
https://0-v-0.github.io/cydon/


## Examples
- [ToDo MVC](https://github.com/0-v-0/cydon/blob/main/packages/examples/todo-mvc.html)
- [JS Framework Benchmark](https://github.com/krausest/js-framework-benchmark/tree/master/frameworks/non-keyed/cydon)

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