Button
A button made of glass. Clear glass bends the page behind it; tinted glass takes your background colour.
glass-button-clear.tsx
Use it for
- One action: a call to action, a toolbar button, a link that looks like a button.
- Clear glass over imagery or colour, where the bend shows.
Not for
- An async action whose result should show on the button: use GlassActionButton.
- Choosing between options: use GlassTabs.
- Every button of a dense form: keep the glass for the action that matters.
Installation
Coming soon
npm install @vitrumui/reactNo dependencies
Usage
app.tsx
import { GlassButton } from '@vitrumui/react/button'
<GlassButton>Get started</GlassButton>
<GlassButton material="tinted" className="bg-sky-500 text-white">Save</GlassButton>
<GlassButton asChild>
<Link href="/docs">Read the docs</Link>
</GlassButton>Examples
Coming soon
API reference
| Prop | Type | Default |
|---|---|---|
materialClear bends the page; tinted uses the background colour. | 'clear' | 'tinted' | 'clear' |
sizeHeight 32, 40, 48 or 64 px. | 'sm' | 'md' | 'lg' | 'xl' | 'md' |
iconAn icon element (e.g. a lucide-react icon). | ReactNode | — |
iconPositionWhich side the icon sits on. | 'start' | 'end' | 'end' |
tintClear glass only: how much tint covers the backdrop (0–1). | number | 0.6 |
asChildPut the glass on the single child element instead of a | boolean | false |
…restPassed to the element ( | button attributes | — |
Accessibility
- A real
<button>(or your own element withasChild): focus, Enter and Space work as usual. - The glass canvas is
aria-hidden; only your label is announced. - Icon-only buttons need an
aria-label.