Introduction
Glass components for React, drawn by one WebGL2 shader.
Vitrum is a set of refractive glass UI components for React, drawn by one WebGL2 shader. Each does one thing the others don't. Install @vitrumui/react and use the components directly in your app.
ButtonSwells under the pointer, bends the page behind it.
Action ButtonThe arrow is a droplet: press it and it melts in for good.
TabsThe selection travels as a lens that magnifies what it passes.
BadgeText flows through the glass; the rim bends each letter.
Slide to ConfirmDrag the glass thumb to the end to confirm.
CardHolds your content; its rim bends what slides behind.
SliderThe thumb opens into a wide lens that bends the track and stretches as it moves.
SwitchThe knob swells into clear glass as it crosses, then settles white.
CheckboxAlways glass: the mark draws itself beneath a clear cap that swells when pressed.
SelectThe list and its button are one liquid: a neck stretches between them, thins and snaps.
Button GroupSeveral buttons, one body of glass.
Dropdown MenuActions pour out of the control that opens them, a whole button group included.
PopoverThe button unfolds into a small surface, right where it is.
Custom GlassAttach real WebGL2 refraction and springs to any element.
ThemingFive optical glass presets and scoped --vitrum-* CSS tokens.
MenuThe button's glass grows into a full menu, on whichever side the menu lies.
How it works
- Zero-dependency engine. One WebGL2 context for the whole page, no three.js required for the core components.
- Your DOM. The glass is a canvas behind your own elements, so any router, any styling and your own markup keep working.
- Free at rest. The render loop runs only while a spring moves and stops completely when nothing does.
Browser support
The glass needs WebGL2, which current desktop and mobile browsers have. Without it, or before the first frame, every component keeps its plain CSS look: never a blank box. With reduced motion the springs stand still and the badge text stops.
Customisation
Customise components through documented props, Tailwind utility classes (className, bg-*, text-*), and CSS variables (--vt-tint).