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 ↗

@yangshun

Copy link
Copy Markdown
Collaborator

I like this idea. It's amazing how flexible Void's architecture is.

Another idea/direction – a @void/astro pages adapter that supports .astro files in Void.

@astrojs/vite-plugin-astro already compiles .astro files in ordinary Vite projects, including scoped CSS, scripts, and framework islands. It deliberately provides no routing, which fits well into the existing architecture.

@cpojer

cpojer commented Nov 17, 2026

Copy link
Copy Markdown
Member

I think this is super interesting. I don't know yet if we should merge this into Void by default – since it's a standalone package it could also be an external project.

This is an interesting direction in contrast to Hono JSX at #731. This PR explicitly only supports server-side rendering, which avoids a lot of the work that the framework adapters are doing. If we want to merge Hono JSX, we should consider either taking the same direction as here (server rendering only), or going all-in and supporting every UI framework adapter feature. We should make a decision for this PR and #731 together.

@kossnocorp

kossnocorp commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

@cpojer @yangshun thank you for the feedback!

@cpojer that's a very good point, I didn't realize there's Hono JSX PR. Also, your comment adds a bit of the context: #731 (comment)

I don't know yet if we should merge this into Void by default

Honestly I doubt there's a point making it an optional extension. I used @void/view in code, but later I realized that it should've been void/view.

The problem I see is that at this point it would be Sisyphus work to try to convince people to adopt a new JSX-based framework as an option. If we make it an extension people can opt into then I believe everyone will ignore it and will become a dead weight we commit to support.

I think the whole idea only makes sense if we commit to make it built-in experience for those who:

  • Needs a static page.
  • Wants to start small and not ready to commit to a heavier view framework yet.
  • Just looking around.
  • Back end engineers that don't have a preference.

Then it would provide Astro-like experience where people able to start small and adopt React/Vue & co incrementally.

I might be dead wrong, but I see it only working as nonchalant "here's how Void make static pages easy, no biggie." VoidZero is a tooling brand and selling a new view framework would be much tougher than a new linter or formatter, not to mention that people are sick of new frameworks.

If you like, I could work on a better implementation, prepare a palatable demo and write a blog post presenting it as a VoidZero experiment and see how people react.

This is an interesting direction in contrast to Hono JSX at #731

I think the same applies there, as if made Hono JSX the default option for Void, that would make Void a stronger offering that works out-of-box.

Although, unlike my proposal, having Hono JSX as an opt-in makes sense as there are Hono JSX users.

However, I think Void View proposal fits Void better as it clicks with loaders naturally whereas Hono JSX kind of asks to use the components body for server side queries.


I have an idea to try to make pages/**/*.server.tsx work without pages/**/*.tsx client counter-part that would utilize hono/jsx and allow defining server components without the problem "am I on server or not?" intrinsic to Next.js-like implementations.

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.

3 participants