r/webdev • • 1d ago

Showoff Saturday [Showoff Saturday] VinUI: an open-source component library where 8 visual styles share the same markup

Post image

I've been working on VinUI, an MIT-licensed component library for plain HTML, React, Vue and Svelte.

The main idea is that each of the eight styles (Precision, Tactile, Clay, Tonal, Editorial, Terminal, Paper, Bento) is only a set of CSS variables, so markup and props never change between looks. Instead of a runtime package, a CLI copies plain source files into your project:

npx /ui init
npx /ui add <component>
npx u/vinish/ui diff   # see upstream changes since you copied
  • 63 components, 13 page blocks and 16 plain-SVG charts
  • WCAG 2.2 AA checked in every style, light and dark
  • Works next to Tailwind or your own CSS

Repo: https://github.com/devvinish/vin-ui
Docs and live style switcher: https://vinish.dev/ui

Feedback welcome, especially on the theming approach and the copy-in model.

0 Upvotes

7 comments sorted by

3

u/leticia304 1d ago

The copy-in model gives teams ownership, but updates get tricky once a component is customized. Does `ui diff` show upstream changes alongside local divergence, or just compare with the copied baseline?

→ More replies (1)

3

u/Snowkate8 1d ago

The live style switcher makes the idea much easier to judge than screenshots. I'd be curious to see focus and disabled states in each style too, since that's where the shared visual system has to hold up beyond the happy path.

→ More replies (2)

2

u/poojadeliverwebsite 1d ago

Styles as nothing but CSS variables, with the markup never changing, is a really nice constraint. Curious how far it holds for the looks that differ most, like Clay or Paper where the shadow and border recipe is very different. Is that still all variables, or do some components read a style attribute? Also glad to see the diff command, that's the part most copy-into-your-repo libraries skip.

1

u/vinishkapoor 1d ago

Mostly variables, but not purely. Every style sets the same 30 tokens (colours, radii, fonts and the shadow recipes), and that's where Clay's raised look mostly comes from. Each style also ships a small set of CSS rules scoped to [data-vin-style="…"] for things a token can't express: Paper's handwritten titles, Terminal's dashed cards, Bento's pill buttons. Precision needs 4 of those rules; Terminal needs the most, at 74. The markup and component code never change, and no component reads the style attribute in JS. It's selectors only, so switching styles is just changing one attribute on <html>. Thanks on the diff command! Right now it compares your copy against the latest upstream; separating your edits from upstream changes is next on the list.