Fine-grained signals
Signals, memos and effects with batched, glitch-free updates.
Veloz is a reactive UI library where signals drive the exact DOM nodes that depend on them. No virtual DOM, no re-renders: components run once.
npm install @velozjs/domRendered DOM
<h4>Order summary0 updates<p>2 items × $24.000 updates<p>Subtotal $48.000 updates<p>Discount —0 updates<p>Shipping $9.000 updates<strong>Total $57.000 updatesComponent ran 1 time. Each row counts its own DOM updates.
Change the order. Only the rows whose text changes light up.
A component is a function that builds real DOM and returns it. What changes later are the functions you put in JSX: each one becomes a live region bound to the signals it reads.
{count} or {() => a() + b()} update; values read in the component body don't.access().import { render, createSignal, createMemo } from '@velozjs/dom';
function Counter() {
console.log('runs once');
const [count, setCount] = createSignal(0);
const doubled = createMemo(() => count() * 2);
return (
<button onClick={() => setCount((c) => c + 1)}>
{count} × 2 = {doubled}
</button>
);
}
render(() => <Counter />, document.body);Signals, memos and effects with batched, glitch-free updates.
renderToString on the server, hydrate on the client, same components.
createResource with Suspense, ErrorBoundary and data handed to hydration.
css, styled and the css prop, CSP-friendly and collected during SSR.
Text is never HTML, URLs and attribute names are validated, innerHTML is sanitized.
ESM only, TypeScript-first, no runtime dependencies.
Read a resource inside Suspense and the fallback shows until the first load finishes. Refetches keep the current content on screen; failures go to the nearest ErrorBoundary. On the server, renderToStringAsync waits for the data and hands it to hydrate().
const [user] = createResource(userId, (id) =>
fetch(`/api/users/${id}`).then((r) => r.json())
);
<Suspense fallback={<Spinner />}>
{() => <h2>{() => user()?.name}</h2>}
</Suspense>Nothing loaded yet. The resource only fetches once its source is set.
Every page here is rendered to HTML by @velozjs/ssr at build time and styled with salve-css. Only the interactive parts (the playground, the async demo, the theme switch and the menu) hydrate, so the rest ships without JavaScript.
Server rendering guidehydrate() reuses those elements, attaches events and effects, and removes the keys.@velozjs/coreSignals, memos, effects, resources, context. No DOM.@velozjs/domJSX runtime, render, hydrate, control flow, sanitizer.@velozjs/csscss``, styled() and the css prop, with SSR collection.@velozjs/ssrrenderToString, renderToStringAsync, renderToStream.vite-plugin-velozJSX setup and SSR module resolution for Vite.Install the package, add the Vite plugin, write JSX.