logoalt Hacker News

Oat – Ultra-lightweight, zero dependency, semantic HTML, CSS, JS UI library

408 pointsby twapitoday at 8:17 AM114 commentsview on HN

https://github.com/knadh/oat

Related: https://nadh.in/blog/javascript-ecosystem-software-developme...


Comments

jamamptoday at 5:12 PM

I think it's valiant to try to do all of this with semantic HTML elements to achieve the right effects, and try to go for a "classless CSS" paradigm to get a nice looking and functional web app (as a fan of classless CSS myself). But scrolling through the component catalog, it unfortunately feels like it's all over the place and inconsistent with semantic vs basic elements, data tags vs aria attributes, and sprinkling some css classes over some of it.

I do very much like that by introducing aria attributes, the CSS reacts to it and styles it appropriately. As opposed to a full-blown react component library which does all of that for you. It would be a good exercise for developers to think aria-first and let the library just help with styling.

Lastly, I think the best part is that this component library has a native sidebar. So many of these I see and they have a nice web page which showcases all the components and I want to replicate their layout and nav/sidebars but they only focus on smaller re-usable components and not the layout. So that's a nice touch, I think. And, as someone who keeps an eye on but doesn't do a lot of frontend, the fact that a sidebar is an aside > nav > ul next to a main just makes so much sense and doesn't have a lot of cruft around it.

skeledrewtoday at 3:12 PM

This site got me going. Almost had whiplash when I tapped a link and the page loaded literally instantly. I've almost forgotten that that's possible on the internet. I'm not a web dev, but I'm inspired to get into it now because of this site.

show 2 replies
JSR_FDEDtoday at 2:26 PM

This has the simplicity I thought I was going to get from DaisyUI but didn’t. Pairing this with Datastar seems like a super powerful combination that leans on actual web standards, not “ecosystems”.

swiftcodertoday at 9:36 AM

The motivating blog post[1] linked from the front page is probably going to generate a more interesting discussion than the framework itself.

As someone who has to deal with both angular and nextjs for different (but overlapping) stacks at work, I find myself increasingly sympathetic to this viewpoint.

[1]: https://nadh.in/blog/javascript-ecosystem-software-developme...

show 3 replies
culitoday at 8:40 PM

<aside> is not the correct semantic element for sidebars. The purpose of <aside> is for content that is indirectly related to the "main" content of the page. Sometimes a sidebar fits that definition but not always

mixmastamyktoday at 8:42 PM

Looks good and like the lightweight aspect. As always, what do I have to do get tabs that look like tabs? What do people have against tabs that look like tabs, instead of buttons?

jitbittoday at 7:52 PM

I tried doing something like that in my app, and quickly discovered that some modern semantic/functional tags are STILL not supported in some browsers. Or work badly.

For example, in Safari showModal for a dialog tag causes recalculating layout for EVERY element on a page, it’s up to 59x slower than chromium…. :(

But I love the idea

mrbluecoattoday at 7:36 PM

Nice solution. Reminds me of https://semantic-ui.com/ and https://fomantic-ui.com/

roxolotltoday at 1:34 PM

There’s a ton of semantic drop in css libraries similar to this. Love seeing new ones. Quality varies wildly but this site shows 50+ drop in stylesheets for those writing semantic html: https://dohliam.github.io/dropin-minimal-css/

show 4 replies
bitbashertoday at 8:23 PM

Confusing name, conflicts with Oat++?

https://oatpp.io/

potato-peelertoday at 10:11 AM

Thank you testing this on older browsers before releasing. This is truly an ultra minimal library - https://ibb.co/DDGmLYdg, https://ibb.co/h1WQG3GK

show 1 reply
eddd-dddetoday at 4:28 PM

The "preview" and "code" buttons in the components break the "alt+arrow" bindings to go back to the previous page. Instead it just alternates between "preview" and "code".

hiyertoday at 11:06 AM

Reminds me of what bootstrap [1] was like around a decade ago. It's gotten quite a bit bloated since then though.

1. https://getbootstrap.com/

anton-107today at 2:34 PM

Why do all the UI component libraries always feature an accordion (something i can build myself in 5 minutes and very rarely need), but always omit a date picker / calendar component (something that is needed almost in every corporate web form and really requires a lot of effort to build)?

show 1 reply
elseleightoday at 6:56 PM

This is a very nice library. At a first reading it seems complete (but did I see summary/detail - I don't remember). Bookmarked for further investigation. Congratulations and thank you.

temporallobetoday at 4:52 PM

This is of special interest to me, because man do I hate UI frameworks with tons of external dependencies. Looking at you, Bootstrap.

show 1 reply
hkttoday at 7:02 PM

This is gorgeous. I hate frontend because of its sheer gratuity, and this is the kind of thing that might get me back into it. The only other contender for interactivity I'd consider is HTMX, and I'm going to boldly assume I'll be able to combine them without too much bother.

Bravo to the author, keep at it. I'll be recommending this to anyone who will listen.

rohitpaulktoday at 9:55 AM

Surprised that none of the comments here are comparing this to Bootstrap.

show 2 replies
kitdtoday at 9:05 AM

Great work! PicoCSS feels a bit too minimalist at times. This looks like a better balance of lightweight and functional.

masklinntoday at 3:44 PM

It’s a bit odd that the accordion uses details but the dropdowns require a custom element.

nkmnztoday at 3:21 PM

I know that guy from listmonk! I always thought the frontend could use some love and planned to spend a couple of days on contributing a couple of ideas, but I never came around. Now I know why things are as they are :)

mkltoday at 9:39 AM

Seems pretty unresponsive to me. I'm getting at least half a second of delay before the accordion, drop-down, or switch do anything. Chrome on Windows.

show 1 reply
scandoxtoday at 5:08 PM

Was looking at the spinner component for a few seconds thinking "that's a bit slow"...

scirobtoday at 7:36 PM

ultra-lightweight, these dev's probably go hiking. I like : )

Xeoncrosstoday at 2:27 PM

Thank you for sharing, I would like to see a navigation/menu component added though as that's required for most websites.

intrasighttoday at 4:20 PM

What's with variable names starting with "#" as first character?

show 2 replies
jlg23today at 9:28 AM

My initial reaction was that I have to use this just because of the buzzword density in the title. But after reading up, it looks like the author was pretty successful in moving the bloat from code to announcement title. I'll give this a try!

bpevtoday at 9:00 AM

Amazing! I recently started building something similar for the same reasons, but more out of frustration rather than out of desire. I'll have to give this one a try and see if it fills the need.

neon_metoday at 8:48 AM

Nice job! Clicked tru my obscure mobile firefox and all worked well!

TrevorFSmithtoday at 12:49 PM

If nothing else, it's refreshing to see nicely modern CSS and JS formatted and laid out in a legible manner. https://github.com/knadh/oat/tree/master/src

Maxiontoday at 9:30 AM

This looks very very cool. Will definitely look in to using this for more static internal tools!

andrei_says_today at 9:13 AM

Thank you for this, can’t wait to use. Minimalism at its best.

vpribishtoday at 7:59 PM

how do you contrast this with https://picocss.com/ ?

I like your presentation of the components, but i'm having trouble finding the essential distinctions

show 1 reply
gaigalastoday at 5:47 PM

The form component:

https://oat.ink/components/#form

Looks a lot like a raw HTML+CSS framework I made in 2009:

https://alganet.github.io/ghiaweb/ (it has some small glitches, browser widgets changed a lot since 2009).

Particularly the use of the label, fieldset and legend elements as native accessible solutions instead of instrumenting divs. Even the styling and the example resembles it a bit!

https://oat.ink/components/#grid

This is where it falls from grace IMHO. Grid classes are fundamentally non-semantic. I know they're popular and useful, but there must be a better (semantic) way of doing this. I haven't found it yet, but there must be.

mgaunardtoday at 10:03 AM

The code example doesn't render for me.

show 1 reply
superkuhtoday at 3:30 PM

No, this is "Oat - Ultra-lightweight, semantic, zero-dependency Javascript UI component library". If it doesn't work without javascript it is not an HTML UI component library.

dankobgdtoday at 2:26 PM

People need to stop with these stupid 12 column grids and learn how grid and flex work. Other elements are ok but this is just stupid

show 1 reply
yoz-ytoday at 9:33 AM

Claims no classes but uses data- attributes and also classes (just look at the button example…)

Looks okay, but I don’t see why to use this over something like Marx if all you need is to not have bare browser default styling.

show 1 reply
mcknztoday at 9:52 AM

should call it oatmilk for max exposure

scandinaviantoday at 9:30 AM

5 day old repo, 2000 stars on GitHub, 400 total weekly downloads on npm. Frontpage of hacker news with a bunch of weird comments. Moderation has been lacking recently.

show 4 replies
koakuma-chantoday at 9:29 AM

This is kind of misleading. It says it's an HTML UI library, then it says HTML + CSS, and then it says it also includes JavaScript. Why is this better than, say, DaisyUI?

show 2 replies
maximalthinkertoday at 2:55 PM

Next:

Oath

Oatly

Ooaut

Oaar

dingitoday at 9:55 AM

[flagged]

radotoday at 9:14 AM

[flagged]

altcunntoday at 6:58 PM

The aria-first approach is underrated here. Most component libraries treat accessibility as an afterthought — you build your UI with divs and classes, then bolt on aria attributes later. Oat inverts this: write the semantic HTML with aria attributes, and the CSS reacts to the state. That's how it should work.

The practical benefit is that your HTML remains meaningful without the CSS loaded at all. Try disabling stylesheets on a typical React component library vs. this — the difference in readability is night and day.

The 18KB total size is notable too. For context, that's smaller than most hero images on a landing page. For internal tools, admin panels, or any project where you don't want to maintain a build pipeline just for UI, this hits a nice sweet spot between raw HTML and a full framework.

show 1 reply
akrausstoday at 10:18 AM

No Datepicker?

show 2 replies
deafpolygontoday at 9:02 AM

[flagged]

show 1 reply
visargatoday at 9:38 AM

This does not even need a LLM skill, just load the whole code up in context, so efficient.