blocks

look

blocks

Typed screens, drawn the same on the web, in SwiftUI and as a static page.

tiles of a screen settling into place
This page is one too.
35core kinds
3renderers: web, SwiftUI, static
13.7 KBof script, gzipped
0lines of hand-written HTML here

One shape for a screen

An app builds a Screen from typed blocks: rows, stats, forms, prose. A server sends it once, then only what changed. Each renderer draws the same tree, and every block carries a fallback, so a renderer that lacks a kind still shows something true.

With JS off, a page is plain HTML: every link works and every word reads. With blocks.js, the page is adopted where it stands, with no redraw.

This page, in Rust

Screen::new().id("home").title("blocks").blocks(vec![
  Block::Nav(Box::new(nav)),
  Block::Hero(Box::new(Hero::new("blocks")
    .subtitle("Typed screens, drawn the same…")
    .actions(acts))),
  Block::Stat(Box::new(Stat::new().items(facts))),
])

Look around

Every page here is a blocks Screen, written by site::page: no hand-written HTML. Source: https://github.com/jirathip-dev/blocks