docs: add "Use daisyUI with Stimulus" guide by neotan · Pull Request #4650 · saadeghi/daisyui · GitHub
Skip to content

docs: add "Use daisyUI with Stimulus" guide - #4650

Open
neotan wants to merge 2 commits into
saadeghi:masterfrom
neotan:docs/stimulus-guide
Open

docs: add "Use daisyUI with Stimulus" guide#4650
neotan wants to merge 2 commits into
saadeghi:masterfrom
neotan:docs/stimulus-guide

Conversation

@neotan

@neotan neotan commented Jul 31, 2026

Copy link
Copy Markdown

Closes #4648

Adds /docs/install/stimulus/, following the "Use daisyUI with HTMX" precedent rather than the install-guide format, since Stimulus does not touch CSS.

Setup is a short tabbed section that links to the existing Rails, Vite, and CLI guides instead of repeating them. The body covers what isn't documented anywhere today: persisting the theme controller, driving a <dialog> modal without an inline onclick, closing a <details> dropdown, and dismissing a toast.

The Turbo section turned up something worth knowing: after a morph refresh with a modal open, the morph strips open from the <dialog> (the server HTML doesn't have it), but the element stays in the browser's top layer holding a full-viewport backdrop. Every click on the page then hits an invisible backdrop, nothing is logged to the console, and it just looks frozen. Adding data-turbo-permanent and an id fixes it, and I tested that rather than assuming it.

Every sample was verified in a running browser before I wrote it up: the four controllers in a Tailwind CLI plus CDN-Stimulus page (22 Playwright assertions), and the Turbo behavior in a Rails 8 app with turbo_refreshes_with method: :morph (30 checks). Where something I expected to break didn't, I left it out rather than padding the page. One behavior is described with no fix, because I couldn't verify one.

You mentioned you'd add the logo, so I haven't touched frameworks.yaml. Here it is inline if it saves you a step, with the width, height and class attributes dropped to match the other entries in that file:

LOGO source: https://stimulus.hotwired.dev/

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60"><g fill="#D9C6A4"><path d="M1.76 1.85885e-08H58.2399C58.7016 -6.70275e-05 59.1447 0.181237 59.474 0.50484C59.8032 0.828443 59.9921 1.26844 59.9999 1.73V7.37823C59.9999 7.87239 59.9999 8.11947 59.9038 8.30822C59.8192 8.47424 59.6842 8.60923 59.5182 8.69382C59.3294 8.78999 59.0823 8.78999 58.5882 8.78999H45.92C44.7722 8.83556 43.6502 9.14343 42.64 9.68999L15.64 25.55C14.6261 26.0964 13.5008 26.4042 12.35 26.45H1.41176C0.9176 26.45 0.670518 26.45 0.481773 26.3538C0.315747 26.2692 0.180765 26.1342 0.0961706 25.9682C0 25.7795 0 25.5324 0 25.0382V17.2717C0 16.7776 0 16.5305 0.0961706 16.3418C0.180765 16.1757 0.315747 16.0408 0.481773 15.9562C0.670518 15.86 0.9176 15.86 1.41176 15.86H12.35C13.5001 15.9106 14.6243 16.2181 15.64 16.76L18.64 18.51C19.1037 18.7494 19.6181 18.8743 20.14 18.8743C20.6619 18.8743 21.1762 18.7494 21.64 18.51L25.48 16.25C25.6438 16.1661 25.7812 16.0386 25.8772 15.8815C25.9732 15.7245 26.024 15.544 26.024 15.36C26.024 15.1759 25.9732 14.9955 25.8772 14.8384C25.7812 14.6814 25.6438 14.5539 25.48 14.47L17.4 9.71999C16.3879 9.17798 15.2669 8.8704 14.12 8.81999H1.41176C0.9176 8.81999 0.670518 8.81999 0.481773 8.72382C0.315747 8.63923 0.180765 8.50424 0.0961706 8.33822C0 8.14947 0 7.90239 0 7.40823V1.76C0 1.29322 0.185428 0.845555 0.515492 0.515492C0.845555 0.185428 1.29322 1.85885e-08 1.76 1.85885e-08Z"/><path d="M47.65 15.8799C46.4998 15.9305 45.3757 16.238 44.36 16.7799L17.36 32.6499C16.3479 33.1919 15.2269 33.4994 14.08 33.5499H1.41176C0.9176 33.5499 0.670518 33.5499 0.481773 33.646C0.315747 33.7306 0.180765 33.8656 0.0961706 34.0316C0 34.2204 0 34.4674 0 34.9616V42.7281C0 43.2222 0 43.4693 0.0961706 43.6581C0.180765 43.8241 0.315747 43.9591 0.481773 44.0437C0.670518 44.1398 0.9176 44.1398 1.41176 44.1398H12.35C13.5001 44.0892 14.6243 43.7817 15.64 43.2398L42.64 27.3699C43.652 26.8278 44.773 26.5203 45.92 26.4699H58.5882C59.0823 26.4699 59.3294 26.4699 59.5182 26.3737C59.6842 26.2891 59.8192 26.1541 59.9038 25.9881C59.9999 25.7993 59.9999 25.5523 59.9999 25.0581V17.2916C59.9999 16.7975 59.9999 16.5504 59.9038 16.3616C59.8192 16.1956 59.6842 16.0606 59.5182 15.976C59.3294 15.8799 59.0823 15.8799 58.5882 15.8799H47.65Z"/><path d="M47.65 33.56C46.4998 33.6106 45.3757 33.9182 44.36 34.46L17.36 50.32C16.3497 50.8666 15.2277 51.1744 14.08 51.22H1.41176C0.9176 51.22 0.670518 51.22 0.481773 51.3162C0.315747 51.4008 0.180765 51.5358 0.0961706 51.7018C0 51.8905 0 52.1376 0 52.6318V58.28C0.0129646 58.739 0.203789 59.175 0.532182 59.4959C0.860576 59.8168 1.30083 59.9976 1.76 60H58.2399C58.7042 59.9974 59.1488 59.8125 59.4781 59.4852C59.8073 59.1578 59.9947 58.7142 59.9999 58.25V52.6018C59.9999 52.1076 59.9999 51.8605 59.9038 51.6718C59.8192 51.5058 59.6842 51.3708 59.5182 51.2862C59.3294 51.19 59.0823 51.19 58.5882 51.19H45.88C44.7322 51.1444 43.6102 50.8366 42.6 50.29L34.52 45.55C34.3536 45.4671 34.2136 45.3394 34.1157 45.1813C34.0179 45.0232 33.966 44.8409 33.966 44.655C33.966 44.4691 34.0179 44.2868 34.1157 44.1287C34.2136 43.9706 34.3536 43.843 34.52 43.76L38.36 41.51C38.8237 41.2706 39.3381 41.1457 39.86 41.1457C40.3819 41.1457 40.8962 41.2706 41.36 41.51L44.36 43.25C45.3739 43.7964 46.4991 44.1042 47.65 44.15H58.5882C59.0823 44.15 59.3294 44.15 59.5182 44.0538C59.6842 43.9693 59.8192 43.8343 59.9038 43.6682C59.9999 43.4795 59.9999 43.2324 59.9999 42.7383V34.9718C59.9999 34.4776 59.9999 34.2305 59.9038 34.0418C59.8192 33.8758 59.6842 33.7408 59.5182 33.6562C59.3294 33.56 59.0823 33.56 58.5882 33.56H47.65Z"/></g></svg>

One thing to check on your side: the mark's own color is #D9C6A4, which reads well on the dark theme but is fairly light on white. If the grid needs better contrast in light mode, swapping the fill for currentColor would work, since all three paths share the one <g fill>.

@neotan
neotan force-pushed the docs/stimulus-guide branch from 89021d5 to 163d380 Compare August 1, 2026 02:14
@saadeghi

saadeghi commented Aug 1, 2026

Copy link
Copy Markdown
Owner

@neotan

neotan commented Aug 1, 2026

Copy link
Copy Markdown
Author

Makes sense, done. The page is now just the install steps, in the same shape as the HTMX guide: install, add to your CSS, build the CSS, start Stimulus, and you have class names available.

While trimming it I caught a bug in my own first draft: I had import { Application } from "@hotwired/stimulus" in a plain script file, which browsers can't resolve without a bundler. It now loads Stimulus from a CDN, which I verified end to end in a fresh project (build produces the daisyUI CSS, the button renders with the primary color, Stimulus starts, no console errors).

Down from 243 lines to 75.

One question, and a no is completely fine. The parts I cut were mostly Stimulus versions of things the component docs already answer for React, for example the React Stackblitz for persisting Theme Controller and the JSX showModal() examples on the modal page. Would you want any of those as Stimulus equivalents on the component pages themselves, as separate small PRs? I'm happy to drop it entirely if you'd rather keep those pages as they are.

@saadeghi

saadeghi commented Aug 2, 2026

Copy link
Copy Markdown
Owner

@saadeghi saadeghi self-assigned this Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: add a "Use daisyUI with Stimulus" guide

2 participants