Badge
A small glass badge with its text flowing through the lens.
glass-badge-basic.tsx
Autumn update
Sliders, switches and checkboxes, now in refractive glass.
NewUse it for
- One short word on a card or a tab: New, Beta, Live.
Not for
- Counts or status that must be read at a glance: the text is moving.
- Several on one screen: the motion competes.
Installation
Coming soon
npm install @vitrumui/reactNo dependencies
Usage
app.tsx
import { GlassBadge } from '@vitrumui/react/badge'
<div className="relative">
<Card />
<GlassBadge className="absolute -top-2 -right-2">New</GlassBadge>
</div>Behaviour
The text is drawn beneath the glass, so the rim bends the letters as they pass. Whatever sits behind the badge shows through, softly blurred. Hovering the badge's positioned parent speeds the flow up. Colour it with bg-* and text-*.
Examples
Coming soon
API reference
| Prop | Type | Default |
|---|---|---|
childrenThe text: one short word. | string | — |
dotColorSeparator colour between repeats. | string | currentColor |
speedLoops per second at rest. | number | 0.4 |
tintOpacity of the badge colour over the backdrop. | number | 0.82 |
classNamePosition and colour ( | string | — |
Accessibility
- The text is announced once, not as a loop.
- With reduced motion the text stands still, centred.