Zubra docs

The Zubra guide#

Moving from 5.x? Migrating to 6.0

Zubra compiles components written as HTML with a script and styles into standard web components: elements that work in plain HTML, in every major framework, and on the server.

Try it first: the playground compiles in your browser and runs your component in plain HTML, React and Vue side by side.

Start an app:

npm create zubra@latest my-app

It asks for a framework (none, React, Vue, Svelte, Solid, Preact, Lit, Angular or Astro, or a server-rendered app with no bundler) and whether components should be TypeScript, and writes a working app: a starter page made of small example components (a counter bound to your framework, a list, a form control, async data, slots), a dev server that updates components in place, a browser test, and an AGENTS.md that explains the app to a coding agent. The starter app says what each file is. With TypeScript (-- --typescript to skip the question) the component is <script lang="ts"> with an interface Props, and npm run check type-checks the components (zubra check --types), for CI.

The tutorial#

Each step builds on the last, in about ten minutes each.

  1. Your first component: props, state, events, and the dev loop.
  2. Templates: conditions, lists, classes and styles, event modifiers, references.
  3. Two-way props and events: what frameworks bind to, and why you rarely fire events by hand.
  4. Composition and slots: components using components, and content passed in.
  5. Forms: elements that are real form controls.
  6. Async data: loading, errors and refetching, without effects.
  7. Server rendering: HTML first, hydrated in place.
  8. Read the output: what Zubra compiles to, and the platform rule behind each part.
  9. Forms that post to the server: 'use server' functions, with or without JavaScript (@zubra/actions).
  10. State that lives on the device: 'use collection', stored in the browser and shared when you want (@zubra/sync).
  11. Motion: content that leaves and lists that glide, with CSS and animate.

Coming from a framework#

Topics#

Reference#

The README is the reference: every feature, option and rule. docs/ has the rest (security, browser support).

Edit this page on GitHub · Zubra 6.0.4