r/webdev • • 5d 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.

10 Upvotes

64 comments sorted by

29

u/Hot-Tip-364 5d 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 5d 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 5d ago

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

12

u/shaliozero 5d ago

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

-22

u/nopeac 5d 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 5d ago

Genuinely an unsustainable metric

-5

u/nopeac 4d 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 4d 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 4d 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 4d 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 4d 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 5d 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 4d 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 4d 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 4d 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 5d 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 4d 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 4d 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 4d 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 4d ago

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

18

u/_squirts 5d ago

If you want the basics to build on top of, try https://modest-ui.com

7

u/fearthelettuce 4d ago

This looks awesome!

2

u/bohdan2 2d ago

Love it

8

u/Both-Tart7460 4d ago

when I built a zero-build client tool last month.

Here are 3 options that actually work with ZERO npm / build step:

  1. Pico CSS (picocss.com)

My absolute favorite. You literally just add one <link> tag in your <head> and all native HTML elements (<button>, <input>, <dialog>, <article>) look clean and polished out of the box with zero custom class names needed. Automatic dark/light theme is built-in.

2. Pure.css (purecss.io)

Super tiny (<4KB gzipped). Made by Yahoo years ago but still rock solid for responsive grids, buttons, tables, and forms without any JS or compilation.

3. Shoelace (now Web Awesome)

If you need interactive UI components (dropdowns, tooltips, drawers) without React or Tailwind, this uses standard Web Components. Just one script tag in HTML and you can use custom elements like <sl-button> directly.

Honestly, modern CSS is also super capable today. With CSS custom properties, native :has(), the <dialog> element, and CSS grid, for smaller projects I often find writing 60-80 lines of clean custom CSS feels even better than loading an external stylesheet.

Hope this helps you find what you need!

1

u/bohdan2 2d ago

These are the classics.

10

u/Past_Brain1826 5d ago

3

u/corvox1994 5d ago

Is it in active development though? The lead dev is known to go AWOL for long periods frequently.

2

u/Past_Brain1826 4d ago

Last update was 2 months ago, so while it may not be super active, it’s certainly not dead. 

2

u/erishun expert 5d ago

This is the answer imo.

5

u/lekoalabe 5d ago

depending on the complexity, https://oat.ink/ is nice , https://github.com/cferdinandi/kelp is interesting
and there are other options if you look for them

2

u/Neither_Worth3542 5d ago

polished" and "no build step" don't usually fit in the same sentence. pick one.

-1

u/nopeac 5d ago

Are these irreconcilable terms? I don't get it.

1

u/private_birb 5d ago

It depends on what you're looking for, but they do exist.

There are some great unopinionated resets out there.

There are semantic HTML-focused libraries that function well as something like an "opinionated reset".

In terms of actual css-only component libraries, I suppose Pure.css might be what you're looking for.

-17

u/nopeac 5d ago

Just checked Pure.css

.button-secondary { 
  color: white;
  border-radius: 4px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

I... I could have achieved something similar myself in a blink. I mentioned I wasn't going with shadcn, but I should have clarified that I was looking for that kind of polished, (<) medium-effort result.

0

u/nopeac 4d ago

People just downvote instead of telling me what I've done wrong. Oh well... "community."

5

u/xkey 4d ago

You're looking for something super specific but also super minimal that lives up to some design standard of which we have no idea. You're shutting down every suggestion. Just do it yourself brother.

0

u/nopeac 4d ago

Snippets of CSS of a button, an input, and a details tag that look similar to each other are a super specific request? Wow.

Look what you can do with 40 loc: https://uiverse.io/chintu_2484/fat-moose-56

Yet I'm being asked to be satisfied with a library where a button has a border radius and a text shadow.

2

u/lucaslamou 4d ago

bulma is still great for this if you want classic classes like buttons and navbars without any npm setup. just a single cdn link and you're good to go

1

u/Guilty-Olive-8827 5d ago

shadcn's CLI is the only thing making it look like a build step. Copy the component files over and you've skipped node entirely, which is more than most 'pure CSS' libraries will give you.

1

u/fearthelettuce 4d ago

Yeah but doesn't it use TW?

1

u/dbbk 4d ago

Yes

1

u/TheRNGuy 4d ago

Radix

1

u/sunesimonsen 4d ago

Not 100% ready for primetime, but I’m looking for feedback on the direction https://microbe.sune.one 

1

u/Standard_Scarcity_74 4d ago

Pico css the closest to polished with zero setup, since you add one link tag from a cdn and your plain html looks good, with a classless mode and built in dark mode. Bulma is also pure css with no javascript and a proper set of components like cards, navbars, and forms, and simple css or water css are good if you only want nice defaults.

1

u/exosoul 2d ago

Basecoat is shadcn but without the decency on react

-1

u/tumsomprasong 4d ago

The most lightweight option is Bootstrap.

-4

u/CarloDaBoss 5d ago

Not sure if you've already seen this option in here, but CodeStitch has been absolutely amazing!!

Especially nowadays, with all the AI tools out there and the junk, it is straightforward and easy to get high-performing websites that rank high on Google. I'm so glad that I stumbled upon some posts by the owner years ago.

I have made websites for friends and family and then businesses near me using the library and can recommend it.

Definitely check it out. There are some free components. https://codestitch.app