Skip to content
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
95db6ce
Updated CHANGELOG and package.json
hexplus Mar 28, 2026
56080d8
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Mar 28, 2026
7eeec49
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Mar 28, 2026
14a9cd4
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Mar 29, 2026
9487727
ci: use npm install instead of npm ci
hexplus Mar 29, 2026
6b4bd83
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Mar 29, 2026
0b9a0cc
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Mar 29, 2026
0777184
trusted-publisher
hexplus Mar 29, 2026
4d46e82
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Mar 29, 2026
bea9788
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Mar 29, 2026
825a8dc
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Mar 29, 2026
55c4436
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Mar 29, 2026
0d2c7e0
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Mar 29, 2026
8da81e8
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Mar 29, 2026
325ce5d
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Mar 29, 2026
0cad329
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Apr 1, 2026
aea6787
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Apr 4, 2026
00e5e88
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Apr 7, 2026
b10a2c5
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Apr 7, 2026
639eae0
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Apr 9, 2026
405e4fe
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Apr 11, 2026
ee7cf48
Updated main
hexplus Apr 11, 2026
8c77fca
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Apr 11, 2026
da6d752
Merge branch 'main' of https://github.com/hexplus/SibuJS
hexplus Apr 11, 2026
7bac9e0
Updated readme file
hexplus Apr 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 33 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,70 +25,56 @@ import { div, h1, button, signal, mount } from "sibujs";
function Counter() {
const [count, setCount] = signal(0);

return div({ class: "counter" }, [
return div("counter", [
h1(() => `Count: ${count()}`),
button({ on: { click: () => setCount(c => c + 1) } }, "Increment"),
button(
{ on: { click: () => setCount(count() + 1) } },
"Increment",
),
]);
}

mount(Counter, document.getElementById("app"));
```

### Three Ways to Author Components
### Authoring Style

SibuJS gives you maximum flexibility with three interoperable styles:

#### 1. Tag Factory
The canonical form: a props object followed by children as a second
positional argument. No `nodes:` key required at any level of the tree —
children can be a string, a number, a single node, an array, or a
reactive getter.
Every tag factory accepts children as an optional second positional
argument. This is **the canonical authoring style** — no `nodes:` key
at any level of the tree. The first argument can be a className string,
a props object, or the children themselves.

```javascript
import { div, h1, label, input, button } from "sibujs";

return div({ class: "counter" }, [
h1({ class: "title" }, () => `Count: ${count()}`),
label({ for: "amount" }, "Step"),
input({ id: "amount", type: "number", value: 1 }),
button(
{ class: "primary", on: { click: () => setCount(c => c + 1) } },
"Increment",
),
// Positional className + children — the default form for styled wrappers
div("page", [
h1("title", "Welcome"),
div("row", [
label({ for: "email" }, "Email"),
input({ id: "email", type: "email" }),
button(
{ class: "primary", type: "submit", on: { click: handleSubmit } },
"Submit",
),
]),
]);
```

All legacy forms — `tag({ class, nodes })`, `tag("className", children)`,
`tag("text")`, `tag([children])`, `tag(node)`, `tag(() => reactive)` —
continue to work unchanged. When both `props.nodes` and the positional
second argument are present, the positional wins.
// Children-only — bare containers
div([h1("Hello"), p("World")]);

#### 2. Positional Shorthand
The tersest form. Class and children as positional arguments, for
layouts with no event handlers or custom props.

```javascript
import { div, h1, button } from "sibujs";
// Text-only
h1("Hello, world!");

return div("counter", [
h1(() => `Count: ${count()}`),
button({ on: { click: () => setCount(c => c + 1) } }, "Increment"),
]);
// Reactive children
div(() => `Count: ${count()}`);
```

#### 3. HTML Tagged Template
Familiar HTML-like syntax using tagged template literals. No compiler needed!

```javascript
import { html } from "sibujs";

return html`
<div class="counter">
<h1>Count: ${() => count()}</h1>
<button on:click=${() => setCount(c => c + 1)}>Increment</button>
</div>
`;
```
Legacy forms — the `{ class, nodes }` prop object and the `html` tagged
template — remain supported by the runtime so existing code keeps
working, but they are no longer the recommended authoring style. When
both `props.nodes` and the positional second argument are present, the
positional wins.

## Learn More

Expand All @@ -102,7 +88,7 @@ For full documentation, guides, and advanced examples, visit our official websit

- **Reactivity:** `signal`, `effect`, `derived`, `watch`, `batch`.
- **Components:** Functional, reusable, and lifecycle-aware (`onMount`, `onUnmount`).
- **Control Flow:** `when` (conditional swaps), `each` (efficient keyed lists), `match` $(pattern matching)$, `show` (toggle visibility).
- **Control Flow:** `when` (conditional swaps), `each` (efficient keyed lists), `match` (pattern matching), `show` (toggle visibility).
- **DOM Utilities:** `Portal` (render out-of-tree), `Fragment` (group children), `Suspense` & `lazy` (async components), `ErrorBoundary`.
- **State Management:** `store` (simple state containers), `deepSignal` (object proxies), `ref`.
- **Performance:** Zero VDOM overhead, LIS-based list diffing, and optional template compilation.
Expand Down
Loading