Skip to content

Void View RFC - #843

Draft
kossnocorp wants to merge 3 commits into
mainfrom
view
Draft

kossnocorp wants to merge 3 commits into
mainfrom
view

Conversation

@kossnocorp

@kossnocorp kossnocorp commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ This is not meant to be merged.


What

Void View is a proposal for a standard Void templating system that allows using JSX to define pages' HTML, as well as reusable components.

By default, JSX results in static HTML with no JS loaded into a page.

Dynamic components, e.g., with let or function event handlers, transform into minimal JS needed to render and update such a component. It utilizes modern web APIs, such as Web Components and <template> elements.

Instead of relying on virtual DOM or any other runtime-heavy way to update HTML, it clones the template element, uses <slot> tags to set interpolation, and simply replaces children with a new element.

Additionally, similar to Astro, it enables component-scoped styles defined in the <style> tag right in a component JSX.

It is based on an idea I explored earlier this year.

To try it, checkout the view branch, inspect ./playground/view and run the playground:

vp run --filter playground-view dev

Examples

Page

This component will result in /about rendering as a static page:

// pages/about.tsx

export default function About() {
  return (
    <>
      <h1>A static page</h1>
      <p>
        This page ships ordinary HTML, with no View templates or component JavaScript.
      </p>
      <a href="/">Back to the playground</a>
    </>
  );
}

Static Component

This component renders to static HTML with .label scoped to the component elements (via .label[data-vv-cid-1f803408]):

// components/Label.tsx

import type { BaseProps } from 'void/view';

export function Label({ children }: BaseProps) {
  return (
    <>
      <span class="label">{children}</span>
      <style>{`
        .label {
          font-weight: bold;
        }
      `}</style>
    </>
  );
}

Dynamic Component

This component renders on the server but also provides JS code that updates it dynamically:

// components/Button.tsx

import { Label } from './Label.tsx';

export interface ButtonProps {
  label: string;
}

export function Button({ label }: ButtonProps) {
  let pressed = false;
  
  return (
    <button
      onclick={() => {
        pressed = true;
      }}
    >
      <Label>{pressed ? 'Pressed!' : label}</Label>
    </button>
  );
}

It will produce JS that looks something like that (simplified from a real example to make it more readable):

register("vv-button", Button);

function Button(props = {}) {
	return component("vv-button", props, (update) => {
		const { label } = props;
		let pressed = false;
		return () => template("vv-button-6a9a04bb", null, [
		  ["event",	"click", () => { update(pressed = true); }],
		  [
		    "child",
		    template("vv-label-dbcf119e", null, [["child", children]])
	      ]
		]);
	});
}

And <template> tags that provide the HTML for client-side rendering (also simplified):

<template id="vv-button-6a9a04bb">
  <button><slot name="vv-slot-0" /></button>
</template>

<template id="vv-label-dbcf119e">
  <span data-vv-cid-dbcf119e class="label">
    <slot name="vv-slot-0" />
  </span>
</template>

Why

Unopinionated Built-in Views

Void has no built-in primitives to define views and requires using React, Vue, Svelte, or Solid, even in the simplest cases.

When needed to add a basic dynamic behavior to a page, i.e., switching tabs on a landing page, it forces including bundle-heavy framework runtimes:

CleanShot 2026-11-16 at 11 10 26@2x

With Void View, it will be possible to work on static pages with some dynamic elements and delay bringing heavier frameworks later.

It preserves a framework-agnostic approach while providing the view aspect without committing to one or another framework.

Portability

JSX components can be easily ported to React, Solid, or Vue. Simplest React components could also be used with the Void View renderer without changing anything.

JSX components are universally understood and without the hooks' complexity.

Performance

Because Void View ships only JS required to coordinate dynamic components rendering, it makes web pages as fast as they can be without losing the comfort of composable components and a simple rendering model.

I also suspect that replacing children with already-parsed <template> tags and the lack of function calls for every tag intrinsic to usual JSX components would be more performant than going through virtual DOM in part of the cases. But I will need to do extensive testing to prove it.

Perfect Fit for Loaders

Theoretically, JSX -> Web Components could be a complex problem if forced to follow the Astro approach and allow putting server code right into the function body.

With Void loaders, there's no such need to handle server-side in these components at all, and it makes the implementation trivial and edge cases very limited.

Glue-Views

Similar to Astro templates, it is possible to extend Void View to allow importing any other framework components and rendering them as HTML or dynamic islands.

Adding MDX or Markdown rendering support to enable using Void for documentation websites is also straightforward and enables a wider range of use cases for Void and hence the Void Platform.

Why Not X

Why not HTML + Raw Web Components

Web Components are fine until you have to rerender a part of it. Then it becomes a mess with bugs all familiar for whoever used to write a lot of jQuery.

Why not Astro

I love Astro, but because it relies on a custom language, it makes it difficult to work with: from tooling support to inability to define two components in a single file.

There's also no answer to adding dynamic behavior, that force to resort to using a view framework or writing JS that binds events and updates DOM manually, which almost always turns into a mess.

Void View is based on plain TypeScript and modern web APIs, making it a lighter, more flexible, and more powerful alternative to Astro.

What's Next?

This is a prototype and not built optimized for production. There are plenty of edge cases that need to be addressed, and also there are plenty of opportunities to juice performance and minimize the amount of JS shipped to the absolute minimum.

All that I would cover in a new PR (along with a more thoughtful implementation) or a thread somewhere is that there's an interest from the team.


Please share your thoughts, concerns or ask any questions.

@kossnocorp kossnocorp changed the title Strandard Void View proposal Void View RFC Nov 16, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://view-void-cloud.voidzero-docs.workers.dev (commit 2a6991b)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://1103574c-void-cloud.voidzero-docs.workers.dev 2a6991b 2026-11-16T03:57:22.220Z Visit the dashboard ↗

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant