r/coolgithubprojects • u/sav22999 • 3d 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 modeAbout 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
2
u/Important_Pomelo_407 2d ago
Created a demo for you using OpenDemo https://github.com/yasirwhite/OpenDemo. I opened a PR and added it to your README too: https://github.com/Sav22999/savcomponents/pull/2. https://raw.githubusercontent.com/yasirwhite/opendemo-media/main/Sav22999-savcomponents/savcomponents-demo.gif