Updated
Light Badge
Customize
Ocean
Stroke1.50px
Radius16px
Ray0.55
Inner0.50
Ray length11px
Period3.6s
Hover intensity0.40
Hover speed0.45
Follow strength0.30
Follow range220px
Installation
npx shadcn@latest add https://uibrik.com/r/light-badge.jsonCopy the source into your project
components/uibrik/light-badge/GradientStrokePill.tsx"use client"; import { forwardRef, type ReactNode, useEffect, useRef, useState, type RefObject } from "react"; import { getRenderer, type BadgeHandle, type BadgeOptions } from "./renderer"; /** * Wrap content that should catch a badge's light (pass the ref to the badge as `castOn`). * * A canvas sits over the content and the badge draws its light into it, cut to the exact shape of * the text, so the light lands on the letters and never on the background around them. */ const LightCatcher = forwardRef< HTMLCanvasElement, { children: ReactNode; className?: string } >(function LightCatcher({ children, className = "" }, ref) { return ( <div className={`relative ${className}`}> {children} <canvas ref={ref} aria-hidden="true" className="pointer-events-none absolute inset-0 size-full" /> </div>
Adds the files to
components/uibrik/light-badge. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/light-badge.Usage
import { GradientStrokePill } from "@/components/uibrik/light-badge/GradientStrokePill";<GradientStrokePill hover follow stroke={1.5} radius={16} ray={0.55} inner={0.5} rayLength={11} period={3.6} hoverIntensity={0.4} hoverSpeed={0.45} followStrength={0.3} followRange={220} castOn={null} // colors={["…"]}> New</GradientStrokePill>Where to use Light Badge
Plan and role highlights
A rotating gradient stroke marks a recommended plan or an admin role.
Pairs with Pricing Glow
New and Pro labels
Soft rays from below make a small badge noticeable without being loud.
Pairs with Announcement Pill
Premium features
A lit badge next to a feature name signals it belongs to a paid tier.
Props
GradientStrokePill- hover
- Type boolean
- true
- Brighten and speed up while hovered.
- follow
- Type boolean
- true
- The light leans toward a nearby pointer.
- stroke
- Type number
- 1.5
- Stroke width.
- radius
- Type number
- 16
- Corner radius.
- ray
- Type number
- 0.55
- Strength of the light rays under the badge.
- inner
- Type number
- 0.5
- Strength of the inner waves.
- rayLength
- Type number
- 11
- How far the rays fall.
- period
- Type number
- 3.6
- Seconds per 360° turn of the stroke gradient.
- hoverIntensity
- Type number
- 0.4
- How much brighter the light gets while hovered (0.4 = 40%).
- hoverSpeed
- Type number
- 0.45
- How much faster the waves run while hovered (0.45 = 45%).
- followStrength
- Type number
- 0.3
- How far the light leans toward the cursor, as a share of the way.
- followRange
- Type number
- 220
- How near the cursor must be for the light to notice it.
- childrenrequired
- Type ReactNode
- –
- Badge content.
- colors
- Type string[]
- –
- Stroke gradient stops, e.g. one of the Colours presets.
- castOn
- Type RefObject<HTMLCanvasElement>
- –
- Canvas below (see LightCatcher) that catches the light.
- className
- Type string
- –
- Classes for the badge.