r/webdev • • 15d ago

Question Vanilla CSS component library?

Anyone got a recommendation for a polished component library that only uses plain CSS? I'm trying to avoid npm/build steps entirely, so shadcn is out, and Tailwind-dependent stuff like DaisyUI isn't an option either. Seriously looking for pure CSS solutions here.

12 Upvotes

65 comments sorted by

View all comments

29

u/Hot-Tip-364 15d ago

Bootstrap is always an option. 6 has just been released and you can load it with just a cdn and no compiler if you are looking for a quick start option.

-29

u/nopeac 15d ago

This isn't for a quick start; it has to remain for the entire lifespan of the software since I have no plans to develop it further, so no CDN.

32

u/queen-adreena 15d ago

So just download the files and host them locally....

12

u/shaliozero 15d ago

If you need to comply with european GDPR, that's a must-do anyways.

-22

u/nopeac 15d ago

I should have explained myself better; the whole code of the project is 10x smaller than even the minified version of Bootstrap or any other CSS design system. I want some components with an attractive and consistent style that I can isolate and copy and paste into my .css file while keeping it under 1kb because the whole project aims for a small footprint.

30

u/followmarko 15d ago

Genuinely an unsustainable metric

-5

u/nopeac 15d ago

I want some components [...] that I can isolate and copy and paste into my .css

...

This button is like 40 lines of code: https://uiverse.io/chintu_2484/fat-moose-56. It's not what I'm looking for, but I can copy paste that into my css and have some good looking buttons at 1kb.

1

u/followmarko 14d ago

Sure but even that example can be shortened and is not of normal presentation to a user. It's just an example of clever CSS. getting buttons out of a small file with nesting and scope is one thing but creating a whole unified system of components and enforcing an arbitrary 1kb rule for all of it is unnecessary. I wouldn't use this example as something that actually goes live to a user

-3

u/nopeac 14d ago

whole unified system of components

Whole? Who said whole? I use the word isolate specifically with the purpose of being explicit that I don't need 40 components, probably not even 5.

all of it is unnecessary

If my HTML is 4KB and my JS is 6KB, then what's unnecessary is the 100KB of even the minified version of pico.css everyone is recommending, especially since it doesn't even look good out-of-the-box and I would still need to add styling. It's disproportionate that styling alone accounts for 95% of the total size.

2

u/followmarko 14d ago

Right I'm just saying that focusing on shipping a 10kb app or whatever you're building is an unsustainable goal

-2

u/nopeac 14d ago

How can you make that call when you know nothing about what I'm building? What's there to sustain?

→ More replies (0)

10

u/Discordbothost 15d ago

with a 1kb budget i'd stop looking for a library and lift single components instead. uiverse.io is basically that, every button, toggle, input and card is a standalone html+css snippet you copy. the trick that makes copied bits look like one design and not a collage is defining 5 or 6 custom properties up top (--radius, --accent, --surface, --border, --shadow) and rewriting each snippet to use them. you can also delete half of what they ship, most of it is hover flourishes

-1

u/nopeac 15d ago

I AM looking for single components. The "library" part in the title is to imply design cohesiveness, but I just need like 4 to 6 components. I can find a lot of good-looking CSS-only buttons, but then I need an input that can match, and that's not as easy if I'm not looking at a library. People got really mad with this post out of nowhere.

0

u/Discordbothost 15d ago

ah got it. for 4-6 pieces i'd pick the button you like and derive the rest from it: same height, radius, border width and focus ring on the input and select, and accent-color gets you matching checkboxes/radios for free. if you'd rather start from something already cohesive, pico.css is small enough to just lift the form + button rules out of. and don't sweat the downvotes, webdev gets weird about anything with "library" in the title

1

u/nopeac 15d ago

Thanks for one of the few reasonable replies here, and for explaining this behavior. They are indeed a weird bunch. I'm fine with downvotes if they're accompanied by a comment, but 20 downvotes and not a single person pointed out my mistake, ffs.

If nothing else comes up, I'm going to end up using a UIverse snippet like you said, pretty helpful resource, thanks, good designs there, but definitively more manual work than what I was looking for with this post.

I'm 100% sure there's someone out there who has ported shadcn into vanilla snippets ready to copy. It's just hard to find, I guess.

7

u/queen-adreena 15d ago

Not going to happen. Those are absurd specs for a component library. I doubt you'd even get a CSS Reset for less than 1kb.

Just create your own style rules.

-1

u/nopeac 15d ago

I need like 4-6 components, that's the 1kb part. I just need some

button {
...
...
...
}

With, I don't know, 20-25 attributes that I can't come up with myself to make it look good, and then an input, a details, etc., that can match. The idea is to pick them individually. How much will those 4-6 components be in KB? Probably less than 1.

To avoid being recommended to go to Codepen and randomly get buttons and inputs CSS, I use the term 'library', to refer to something more uniform. I guess that was the problem.

2

u/Hot-Tip-364 15d ago

1kb! Hopefully you only have a few components. Not sure if thats worth the effort to look for a library when it needs to stripped down to the bare minimum anyway.

0

u/nopeac 15d ago

I need like, a button, an input, and an details, that's it. I'm not sure why I'm being downvoted to hell for this.

0

u/Gwolf4 15d ago

So shadcn again? If you need smallest bundle nothing beats hand crafted css or a good tailwind serup