Alloy CSS Ships Dialogs, Menus and Tabs That Work With JavaScript Off in About 24 KB. Check the Browser Floor Before You Drop It Into a Client Project.
A Show HN post this week put Alloy CSS on the Hacker News front page with the pitch "dialogs, menus and tabs that work with JavaScript off." It's a free, MIT-licensed stylesheet from Fandy Pradana, aimed at server-rendered apps in Rails, Django, Laravel or htmx. The README puts the minified file at about 24 KB gzipped. The interesting part is how little of it is Alloy and how much is the browser, and that's also where the catch is: the dialog buttons need Chrome or Edge 135, Firefox 144 or Safari 26.2.
What it is
Alloy is one CSS file, with no build step and no runtime. You link it from a CDN:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@alloyhtml/css@1/dist/alloy.min.css">
Or you npm install @alloyhtml/css and link the file from node_modules. There are two dark themes as separate files, and Sass sources if you want to change variables at build time.
The home page lists dialogs, menus, drawers, tabs and toasts. The docs go further, with accordions, a carousel, tooltips, tables, form fields, buttons and a large set of utility classes. The author also sells a pack of 82 page templates for $29 once. The CSS kit itself is free, and the repository had 23 stars when I looked, so this is very early.
The browser does the work
Here's the pattern for a modal, trimmed from the project's own example (I've shortened the class lists):
<button type="button" commandfor="saved" command="show-modal" class="button">Save</button> <dialog id="saved" closedby="any" class="dialog"> <p>Saved.</p> <button type="button" commandfor="saved" command="close" class="button">Close</button> </dialog>
Nothing in that snippet belongs to Alloy except the class names. <dialog> is the native modal element. command and commandfor are the invoker attributes that let a button open or close a dialog without a click handler. closedby="any" tells the browser to close the dialog on Esc or a click outside it.
Menus, drawers and toasts use the popover attribute. Accordions use <details name="...">, where sharing a name means opening one closes the others. The styling leans on :has(), color-mix() and light-dark().
I like this a lot as a direction. Every one of those behaviours used to mean a JavaScript component with focus trapping and Esc handling that somebody had to maintain. When the element is native, the browser owns those parts, and I own some class names.
The browser floor is the real decision
The docs give two floors. The kit as a whole works from Chrome 123, Edge 123, Firefox 125 and Safari 17.5. Dialogs need more, in the docs' words: "Dialogs need newer still: their buttons use command and commandfor, from Chrome and Edge 135, Firefox 144 and Safari 26.2. On an older browser the button that opens a dialog does nothing."
Read that last sentence twice. On an older browser there's no fallback and no error. The user clicks Save and nothing happens.
There's a second, smaller gap. The docs say closing a dialog by clicking outside it works from Safari 27.3, while Esc and the close button work everywhere the dialog does. So on Safari versions before 27.3 you'd get a dialog that opens, with one of its three ways out missing.
Those version numbers are the author's own statements. The pages don't use Baseline labels, so I'd confirm each feature against MDN or caniuse for the browsers my users have.
Two components still need script. The docs say the toast and the copy button each need one line, and a theme switch needs a script too. "Works with JavaScript off" is accurate for the dialogs, menus, drawers, tabs and accordions.
Where it fits and where it doesn't
For an internal admin panel, a back office for a client who runs current Chrome, or a side project where I pick the browser support, this is close to ideal. A Django or Rails app that renders HTML can get modals and dropdown menus with zero front-end tooling.
For a public checkout or a signup form, I'd be careful. A "Confirm" button that silently does nothing on a two-year-old iPad is the kind of bug that never reaches your error tracker, because no script ran to report it.
It's also a poor fit if you already have a component library. Adding a second design system for the sake of removing some JavaScript is more work than it saves.
How I'd try it
I'd pick one server-rendered page that has a modal and a dropdown today, and rebuild just those two with Alloy on a branch.
Then I'd test the failure case on purpose. Open the page in a browser below the dialog floor and click the button. If nothing happens, I'd add a small feature check that falls back to a plain link or a full page for that action:
<script>
if (!('commandForElement' in HTMLButtonElement.prototype)) {
document.documentElement.classList.add('no-invokers');
}
</script>
That's my own guard, not something Alloy ships, and yes, it's JavaScript. Ten lines of fallback is still a long way from a component framework.
I'd pin the exact version, too. The install snippet uses @1, which floats across every 1.x release. For a project this young, I'd pin a full version number in the URL or vendor the file into the repo, so a Tuesday release can't restyle my app.
The kit includes npx @alloyhtml/css check <dir>, a linter for your markup, and an optional skill file for coding agents. I'd run the linter in CI if I adopted it.
Where I could be wrong
Evergreen browsers update fast, and by the middle of next year the dialog floor may cover nearly everyone you care about. If your analytics already show that, my caution about public pages is overdone.
I've read the docs and the example page, and I haven't shipped Alloy in a product. The accessibility claims, such as the docs' statement that every text and border pair passes AA contrast in every theme, are the author's. I'd run my own keyboard and screen reader pass before trusting them. With 23 stars and one maintainer, you should also assume you might end up maintaining your copy.
What I'd actually do
Use it for the next internal tool or admin page, with a pinned version and the fallback check. Hold off on public payment and signup flows until your own browser numbers clear the 135, 144 and 26.2 floor.
Even if you never install Alloy, steal the idea. <dialog>, popover and <details name> are in the browser now, and you can delete a modal library with thirty lines of your own CSS.
Author
Lukas
@lukcombinator