Stimulus

stimulus.hotwired.dev

Lightweight JavaScript framework designed to enhance existing HTML with interactivity rather than replace it.

Overview

Stimulus is a lightweight JavaScript framework designed to enhance existing HTML with interactivity rather than replace it. It uses simple data attributes (controller, target, action) to connect HTML elements to JavaScript controllers, making it easy to add behavior to server-rendered or static HTML.

The framework pairs well with Turbo and other tools from Hotwire, providing a minimal-effort approach to building fast, interactive applications. It's particularly suited for developers who prefer working with HTML-first approaches rather than JavaScript-heavy single-page applications.

Key features

  • Data attribute-based controller binding
  • Lifecycle callbacks
  • Action handling
  • Target and outlet management
  • CSS class manipulation
  • TypeScript support
  • Minimal learning curve
Pros
  • Lightweight and modest in scope
  • Works with existing HTML
  • Simple attribute-based API
  • Pairs well with Turbo
  • No rendering overhead
  • Easy to integrate into server-rendered applications
Cons
  • Limited to behavior augmentation, not rendering
  • Requires HTML-first architecture
  • Smaller ecosystem compared to React or Vue
  • May not suit complex single-page applications
Use this if
You want to add interactivity to server-rendered HTML without building a full single-page application, or you prefer an HTML-first development approach.
Skip this if
You need a framework for building complex client-side applications with sophisticated state management, or you require extensive rendering capabilities.

Best for

Augmenting server-rendered HTML with interactivityHTML-first development approachesBuilding fast applications with minimal JavaScriptPairing with Turbo for complete Hotwire solutions

Alternatives

ReactVue.jsAlpine.jshtmx

Compare Stimulus alternatives

More Framework

Compare all
View Jasmine
Jasmine

Testing framework designed specifically for JavaScript code.

View Next.js
Next.js

React framework for production with SSR, static generation, API routes, and App Router.

View eve
eve

Framework for building autonomous AI agents, designed by Vercel as a filesystem-first approach to agent development.

View Ivy Framework
Ivy Framework

Modern C# framework designed for building reactive full-stack web applications entirely in pure C#.