Each example below is a small, runnable Go program that lives in the HLive repository. Every example also has its own page here with its real source code embedded, so you can read it without cloning anything.

Simple

  • Click — Click a button and watch a counter update in place.
  • Hover — Hover over an element and see another element change.
  • Diff Apply — Trigger server-side logic when a DOM change finishes applying in the browser.

Advanced

  • Animation — Chain Diff Apply callbacks into a continuously running animation.
  • Clock — Push DOM changes from the server without any user interaction.
  • File Upload — Inspect a file before uploading it, then trigger the upload from the server.
  • Initial Sync — Recover form field values a browser refuses to clear on page reload.
  • Local Render — Render a single component instead of the whole page after an event.
  • Session — Implement a user session with middleware and cookies.
  • To Do List — A simple to-do list app.
  • URL Parameters — Pass URL query parameters through to a Component.
  • Preempt — Update the browser optimistically before the server responds.
  • PubSub — Decouple form components from each other with a shared publish/subscribe bus.