Library / SDK
excid3/tailwindcss-stimulus-components avatar
excid3/tailwindcss-stimulus-components

tailwindcss-stimulus-components for TailwindCSS and Stimulus

A set of StimulusJS components for TailwindCSS apps similar to Bootstrap JS components.

1,516 stars146 forksJavaScriptMIT

At a glance

What is it?
tailwindcss-stimulus-components supplies Stimulus controllers for alerts, dropdowns, modals, tabs, toggles, and related TailwindCSS interface patterns. It fits applications that already use Stimulus but need a documented controller set without adopting Bootstrap's JavaScript layer.
Who is it for?
Adopt this package when an application already uses Stimulus 3 or later and wants reusable TailwindCSS-oriented controllers. Do not adopt it merely for CSS, because it does not supply a complete visual system or document every interaction pattern in the README.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 80 days ago.
What is it written in?
Mainly JavaScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 20, 2026, and from our analysis. They are not legal advice.

Editorial analysis

Why tailwindcss-stimulus-components fits existing Stimulus applications

The package addresses a specific gap in TailwindCSS applications. TailwindCSS supplies utility classes, but utilities by themselves do not implement interface behavior such as changing tabs, opening a modal, showing a dropdown, or toggling a panel. tailwindcss-stimulus-components places those behaviors in Stimulus controllers that can be registered by name and connected through HTML data attributes.

The intended audience is developers who have already installed StimulusJS and use TailwindCSS for presentation. That precondition matters. The README does not present this as a standalone JavaScript framework, a component stylesheet, or a complete replacement for every UI requirement. It assumes an existing Stimulus application and adds reusable controllers for it.

The available exports cover a broad but finite set: `Alert`, `Autosave`, `ColorPreview`, `Dropdown`, `Modal`, `Tabs`, `Popover`, `Toggle`, and `Slideover`. The package also lists a transition utility under `docs/`. Developers may register all of these controllers or import only the components they need. Selective registration is the more precise option for an application that has no need for autosave, popovers, or slideovers, because it keeps application startup explicit and avoids attaching unused controller names to the page.

The MIT license also makes the package straightforward to include in an open source application, subject to the actual license text. That is a repository and packaging fact, not legal advice about a particular distribution model.

How Stimulus registration connects package controllers to page markup

The integration point is the Stimulus `Application` instance. The documented sequence starts `Application.start()`, imports named controllers from `tailwindcss-stimulus-components`, and calls `application.register()` with a data attribute identifier and its controller class. Stimulus then discovers elements carrying that identifier and manages the controller lifecycle for each matching element.

This architecture leaves application markup and visual styling under the host application's control. The README states that the components do not require specific styles. Instead, Stimulus relies on correctly defined `data-` attributes to trigger actions and locate targets. In other words, the package supplies behavior through controllers, while TailwindCSS utility classes determine how the resulting elements appear.

The package metadata confirms that `@hotwired/stimulus` is a peer dependency rather than an ordinary bundled dependency. Its declared range is `>= 3.0.0`, and the build scripts mark `@hotwired/stimulus` as external. This separation lets the application control its Stimulus version and prevents the package from silently supplying a second Stimulus runtime. It also creates a compatibility boundary: installation does not remove the need to satisfy that peer dependency.

Controllers can be subclassed. The documented extension example imports `Dropdown`, declares an additional `button` target, calls `super.connect()`, and reads `this.buttonTarget.value`. A subclass can access targets declared by its parent controller. If it overrides `connect`, `disconnect`, or another parent method, the README says to invoke the corresponding `super.method()` so the inherited behavior still executes.

Installing the package in npm, Yarn, or a Rails importmap

The project assumes StimulusJS is already installed. For a Yarn application, the README provides this command:

bash
yarn add tailwindcss-stimulus-components

This adds the package to the Yarn-managed project. For an npm application, use:

bash
npm install tailwindcss-stimulus-components

The npm route is also the one named by the contributor test instructions. Rails applications using importmaps can pin the module through the documented Rails command:

bash
bin/importmap pin tailwindcss-stimulus-components

These commands do not install Stimulus for you. The reader should already have a functioning Stimulus setup and must ensure that it satisfies the package's `>= 3.0.0` peer dependency. For a first integration, npm or Yarn is followed by controller registration in the application's JavaScript entry point. The importmap path still requires the application to load the resulting module and register its controllers in a way that fits its Rails asset setup; the README does not provide a separate importmap registration example.

The package publishes both `main` and `module` entries in `package.json`: `dist/tailwindcss-stimulus-components.cjs` and `dist/tailwindcss-stimulus-components.module.js`. Source and distribution files are included in the published `files` list. This packaging shape supports CommonJS and ES module consumers, although the documented usage example uses ES module imports.

Registering a selective first controller set

A first application-level use is to start Stimulus and register the named exports required by the page. This example follows the README's complete controller list:

javascript
import { Application } from "@hotwired/stimulus"

const application = Application.start();

import { Alert, Autosave, ColorPreview, Dropdown, Modal, Tabs, Popover, Toggle, Slideover } from "tailwindcss-stimulus-components"
application.register('alert', Alert)
application.register('autosave', Autosave)
application.register('color-preview', ColorPreview)
application.register('dropdown', Dropdown)
application.register('modal', Modal)
application.register('popover', Popover)
application.register('slideover', Slideover)
application.register('tabs', Tabs)
application.register('toggle', Toggle)

The registration names become the identifiers associated with Stimulus controller attributes. The reader should see the application start without an import or peer-dependency error, then find controller activation only where the corresponding identifier appears in the document. Exact actions, targets, values, and class names for a component are not specified in the README. They are documented in the component files such as `docs/alert.md`, `docs/dropdown.md`, and `docs/modal.md`, so a production integration should follow the relevant page rather than infer a Bootstrap-compatible API.

A smaller application can import only `Modal`, `Dropdown`, or another required controller and register only that class. The README explicitly permits importing all components or just the ones needed. This is preferable when page markup does not use the other interactions.

TailwindCSS styling, modal structure, and browser support boundaries

The package deliberately separates behavior from appearance. According to the README, component styles are configurable and the controllers do not require one specific set of styles. This is appropriate for TailwindCSS users because utility classes can be changed without replacing the controller implementation. It also means installation alone does not create a complete modal, dropdown, or tab interface. The host application must supply suitable markup and classes.

The modal has one additional structural constraint. Its documentation requires certain browser-facing styles, including separate container and background elements so the modal can be fixed inside a fixed-size container. That distinction is more than a visual preference. Removing or merging those elements can undermine the placement and behavior described by the project. Teams adopting `Modal` should therefore read `docs/modal.md` before translating its example into application templates.

The `package.json` browserslist is `defaults` with `not IE 11`. The ESM and CommonJS builds target `es2020`. These are concrete package constraints, but the README does not publish a complete browser support matrix or accessibility evaluation. It also does not claim that every exported component exposes keyboard navigation, focus trapping, or screen reader behavior. Such qualities should not be inferred merely from names such as `Modal` or `Toggle`; they must be checked in the component documentation and tested against the application's markup.

That makes this package a fit for teams already prepared to own interaction details. It is a poor choice for a designer seeking a ready-made, fully styled component library with documented accessibility guarantees.

Maintenance, upgrades, and the Bootstrap-oriented alternative

The repository is not archived. Its last push was on 2026-08-04, and the listed `v6.1.4` release is dated 2026-06-03. Those facts indicate recent repository and release activity at the time represented by the project record. They do not remove the normal upgrade work associated with a JavaScript package.

An upgrade can affect import compatibility, peer dependency requirements, controller behavior, and the markup expected by individual components. The repository includes `CHANGELOG.md`, component documentation under `docs/`, and tests under `test/`, but the README does not describe a migration guide for every release. Applications should review release notes and component pages before changing the installed version, particularly if they subclass controllers or override lifecycle methods.

Bootstrap JS is the project's stated point of comparison. tailwindcss-stimulus-components aims to make adding JavaScript components as convenient for TailwindCSS users. Another approach is to write local Stimulus controllers. That avoids adopting a shared component package, but transfers controller design, inheritance, documentation, and regression responsibility to the application. This package is the middle path: reusable controllers with TailwindCSS styling left to the host project.

The package publishes CommonJS and ES module builds and declares modern browser output, so an upgrade should be checked against the application's bundler, Stimulus version, and browser targets. The MIT license permits use under its terms, while published builds include source files under the declared package license.

Editorial conclusion

Adopt this package when an application already uses Stimulus 3 or later and wants reusable TailwindCSS-oriented controllers. Do not adopt it merely for CSS, because it does not supply a complete visual system or document every interaction pattern in the README. Verify first that `@hotwired/stimulus` satisfies `>= 3.0.0`, that your HTML uses the required Stimulus attributes, and that the selected component's `docs/` page fits your markup.

Frequently asked questions

How do I install tailwindcss-stimulus-components?

Install it with `yarn add tailwindcss-stimulus-components`, `npm install tailwindcss-stimulus-components`, or `bin/importmap pin tailwindcss-stimulus-components`. The project assumes StimulusJS is already installed and declares `@hotwired/stimulus` as a peer dependency of `>= 3.0.0`.

How do I register tailwindcss-stimulus-components with StimulusJS?

Start a Stimulus `Application`, import the named controllers, and pass each controller to `application.register()`. The README shows registrations for `alert`, `autosave`, `color-preview`, `dropdown`, `modal`, `popover`, `slideover`, `tabs`, and `toggle`.

Does tailwindcss-stimulus-components include the styles for its components?

No. The README says the components do not require specific styles, and styling is configurable through the host application. It does call out necessary browser styles for the modal, whose container and background are separate elements.

Official sources

  1. excid3/tailwindcss-stimulus-components on GitHub
  2. License: MIT
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/excid3-tailwindcss-stimulus-components.svg)](https://hysenlabs.com/projects/excid3-tailwindcss-stimulus-components)