r/webdev • u/sav22999 • 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:
- SavOffice, a free, open office suite: https://www.illerom.eu/savoffice/
- SavPresentations: https://www.illerom.eu/savpresentations/
- SavDocuments: https://www.illerom.eu/savdocuments/
- SavSchedules: https://www.illerom.eu/savschedules/
- SavNotes: https://www.illerom.eu/savnotes/
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
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.
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?
2
u/Prestigious-Job-5710 1d ago
Love that it uses
ElementInternalsfor 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.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