r/webdev • • 1d ago

Meet SavComponents: 80+ vanilla JS web components you use as plain HTML tags (MIT)

Hi everyone! For the past few weeks I've been working on SavComponents, a free, open-source library of web components. I wanted UI pieces I could drop into any page, whether it's a static HTML file, a server-rendered site or an app, without installing a framework or setting up a build step.

Getting started is two lines:

<link rel="stylesheet" href="https://savcomponents.com/v/1.3.2/sav.css">
<script src="https://savcomponents.com/v/1.3.2/sav.js" defer></script>

<sav-button>Hello</sav-button>

What's in it

  • 80+ components: buttons, inputs, select with search, date and time pickers, colour picker, OTP, password strength, dialogs, popovers, action sheets, toasts, tabs, tables, charts, timeline, drag-and-drop sorting, and more
  • Five visual styles (Soft, Tilt, Sharp, Brutal and Glass), switched with a single class on <html>, plus light, dark and auto mode
  • About 2,000 icons, loaded only when you use them
  • English and Italian built in, and you can add any language with Sav.addStrings()

How it's built

It's all vanilla JavaScript on web standards: no dependencies, no framework. Each component is a custom element with its own Shadow DOM, with styles shared through adoptedStyleSheets. Form fields are form-associated custom elements (attachInternals()), so they submit inside a normal <form> and work with native validation (required, checkValidity()…), with no hidden inputs. Theming goes through CSS custom properties (--sav-color-primary, --sav-radius, --sav-font…), and there's a customiser on the site that exports them for you.

Since they're standard custom elements, they work in plain HTML and alongside most frameworks.

Accessibility

I tried to treat this as a requirement, not an afterthought. Keyboard navigation and screen reader support are built in, and every component page has a WCAG 2.2 AA section that documents keyboard behaviour and roles, and measures contrast live in the current style and theme.

Versioned URLs

Each release lives at its own frozen address (/v/1.3.2/), so your site won't change when a new version comes out. You move to a new version when you decide to.

Used in real projects

I use SavComponents myself in a few apps I'm building, so it gets tested on real interfaces and not just on demo pages:

Where it's at

It's still a young project, and there's plenty I want to improve. For example, the JS isn't minified yet (it's about 180 KB gzipped). I'd love honest feedback: what's missing, what feels off, or anything that breaks.

→ Docs and live demos: https://savcomponents.com
→ Source: https://github.com/Sav22999/savcomponents

0 Upvotes

18 comments sorted by

7

u/fiskfisk 1d ago

Be aware that loading remote JavaScript into your site will give the owner of the script full access to whatever lives inside your application. 

-6

u/sav22999 1d ago

Thanks for your suggestion. I'll do all tests I can to avoid any security issues. Thanks.
The library is open-source and if anyone want to use it, he/she/they can check if it's safe or not, and in case contribute to improve the project

6

u/fiskfisk 1d ago

It's more a warning to users to not trust anything hosted by random people remotely.

What's on GitHub might not match what's being served on the domain, you might not renew the domain (allowing anyone to register it and trojan any site that loads their script from your site), someone getting access to your server/s3/dns account etc. will be able to trojan any remote site, etc.

The least you should use if loading something remotely is an integrity attribute to ensure the script hasn't been replaced beneath you - but in any case, make a local copy and serve that.

Your users probably aren't that happy about their browsing pattern being sent to a random reddit user. 

-7

u/sav22999 1d ago

Fair points, and they apply to any third-party script loaded remotely, not just mine. A few concrete responses:

Self-hosting: agreed, that's the safest option, and since the library is MIT there's nothing stopping anyone from downloading and serving it locally. I'll make this recommendation much more prominent in the docs — you're right that I'm currently showing the CDN approach as the default.

Integrity attribute: good suggestion. Since each release is a single frozen file at a versioned URL (/v/1.3.2/), shipping an SRI hash alongside each release is feasible and I'll look into it.

Domain/server compromise: a real risk for any vendor-hosted asset. SRI and the frozen versioned URLs mitigate the silent-replacement part; self-hosting eliminates the rest.

On the "random reddit user" point: I get the skepticism, but I'm not anonymous — I've been shipping open-source, privacy-first software for years under my real name. A few examples: Notefox and Emoji (Firefox add-ons), Sav PDF Viewer. All of them were built around the same principles: privacy and the user at the center. I'd still encourage anyone to audit the code rather than trust me — that's exactly why it's open source.

Regarding browsing data: the script is a plain static file with no telemetry of any kind, so nothing about your users is collected by me. And if you self-host, not even the request reaches my server.

Thanks for pushing on this — the docs will be better for it.

1

u/fiskfisk 20h ago

I spent the time replying, at least you could as well. I don't need your LLM's response to my points. 

Whether you collect anything isn't the point, you still see get the request and the referer. Which generally isn't really ok. 

1

u/sav22999 19h ago

The answer wasn’t from an LLM. But ok, I spent enough time with you. Thanks for your suggestions, have a nice day.

3

u/Potential_Fly_7506 1d ago

80+ components with charts, drag and drop and 2000 icons in a few weeks. Be honest, how many of those are a div with a class on it?

0

u/sav22999 1d ago

Ehm, ok? You can check the source, it's open-source

2

u/Prestigious-Job-5710 1d ago

Love that it uses ElementInternals for native form submission and validation with zero build step super clean for quick static pages or dropping into existing apps without dragging in a heavy framework.

1

u/sav22999 1d ago

Thanks! Going framework-free was deliberate: I've been writing vanilla JS for 15–16 years and it's still my preferred way to build. That said, I'm pragmatic: I do reach for Vue or similar when the project calls for it.

5

u/seweso 23h ago

Why is everything...crooked?

2

u/dzerominus 22h ago

I like the style. Good job I say.

2

u/Agile_Arugula_7496 20h ago

Example pages are very broken on mobile. You might want to look into that

1

u/halfllama 23h ago

The 180 KB gzipped script is the main thing to consider before using it on a small page. Does it register every component up front? A page with one button could still download the charts and date pickers too. A build-free option that scans for sav-* tags and loads only their component modules could preserve the plain-HTML setup without making every page pay for the whole library. Even a button-only example with its transfer size next to the full bundle would make that tradeoff easy to judge before trying it.

1

u/[deleted] 1d ago

[removed] — view removed comment

1

u/webdev-ModTeam 1d ago

Your post/comment has been determined to be a low-effort post or comment. This includes title-only posts, easily searchable questions, vague/open-ended discussion prompts, LLM generated posts or comments, and posts/comments that do not provide enough context for meaningful replies or discussion.

0

u/sav22999 1d ago

Yup, it's a library, not a framework. That was one of my desiderata.

Do you have any interesting feedback about the library and components?