1.0.0 • Published 1 month ago

vanjs-element v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Van Element - WebComponents with VanJS

A simple function to create VanJS web components. See it in action.

Documentation

https://van-element.pages.dev/.

Usage

import van from "vanjs-core";
import { define } from "vanjs-element";

const { button, div, slot } = van.tags;

define("custom-counter", () => {
  const counter = van.state(0);
  return div(
    slot(),
    counter,
    button({ onclick: () => ++counter.val }, "+"),
    button({ onclick: () => --counter.val }, "-")
  );
});

In your HTML:

<custom-counter>❤️</custom-counter>

<custom-counter>👌</custom-counter>

Why use this

  • automatic hydration of VanJS inside your HTML
  • reusable components without extra boilerplate
  • isolated styles and slots with Web components
  • only 40 lines of code (300b min+gzip)
1.0.0

1 month ago

0.2.4

3 months ago

0.2.3

4 months ago

0.2.2

4 months ago

0.2.1

5 months ago

0.2.0

5 months ago

0.1.0

5 months ago

0.1.2

5 months ago

0.1.1

5 months ago

0.1.4

5 months ago

0.1.3

5 months ago

0.1.5

5 months ago

0.0.1

5 months ago