--- name: datastar description: Guide for building interactive web UIs with Datastar and gomponents-datastar. Use this skill when adding frontend interactivity to Go web applications with Datastar attributes. license: MIT --- # Datastar ## Overview Datastar is a lightweight frontend framework that enables backend-driven, interactive UIs through a hypermedia-first approach. It combines backend reactivity (similar to htmx) with frontend reactivity (like Alpine.js) using standard HTML `data-*` attributes. ## When to Use This Skill Use this skill when: - Adding frontend interactivity to server-rendered HTML - Building reactive UIs driven by backend state - Using Datastar with gomponents in Go applications - Working with Server-Sent Events (SSE) for real-time updates **Prerequisite:** When using Datastar with Go, also use the **gomponents** skill for HTML component patterns. ## Installation ### Browser (CDN) ```html ``` ### Go (gomponents-datastar) ``` go get maragu.dev/gomponents-datastar ``` --- # Part 1: Datastar Fundamentals ## Core Concepts ### Signals Signals are reactive state containers. When a signal's value changes, all dependent expressions automatically update. ```html