/Click feedback
Click feedback • CSS
What's New Glow Button
A dark, fully rounded button whose orange and blue glows follow the cursor.
Installation
Requires lucide-react for its icons. The shadcn CLI installs it for you; copying the code by hand means installing it yourself.
Terminal
npx shadcn@latest add https://microkit.co/r/whats-new-glow-button.jsonCode
TypeScript component
1"use client";23import type { PointerEvent as ReactPointerEvent } from "react";4import { ArrowRight } from "lucide-react";56export function WhatsNewGlowButton() {7const updateGlow = (event: ReactPointerEvent<HTMLButtonElement>) => {8const bounds = event.currentTarget.getBoundingClientRect();9const position = Math.max(0, Math.min(100, ((event.clientX - bounds.left) / bounds.width) * 100));10event.currentTarget.style.setProperty("--glow-x", `${position}%`);11};12const resetGlow = (event: ReactPointerEvent<HTMLButtonElement>) => {13event.currentTarget.style.setProperty("--glow-x", "50%");14};1516return (17<button type="button" className="whats-new-button" onPointerMove={updateGlow} onPointerLeave={resetGlow}>18<span className="whats-new-content">19<ArrowRight size={16} strokeWidth={2.5} />20{"What's new"}21</span>22<span className="whats-new-glow whats-new-glow-orange" aria-hidden="true" />23<span className="whats-new-glow whats-new-glow-blue" aria-hidden="true" />24</button>25);26}
CSS
1.whats-new-button {2--glow-x: 50%;3position: relative;4display: inline-flex;5align-items: center;6justify-content: center;7min-height: 42px;8overflow: hidden;9border: 1px solid #36383d;10border-radius: 999px;11background: #0e0e10;12padding: 0 18px;13color: #f0f0f0;14font-size: 16px;15font-weight: 500;16}17.whats-new-content {18position: relative;19z-index: 1;20display: inline-flex;21align-items: center;22gap: 9px;23}24.whats-new-glow {25position: absolute;26bottom: -108%;27width: 112%;28height: 180%;29border-radius: 999px;30filter: blur(23px);31opacity: .28;32transition: left .22s cubic-bezier(.16, 1, .3, 1), transform .45s cubic-bezier(.16, 1, .3, 1), opacity .3s ease;33}34.whats-new-glow-orange {35left: calc(var(--glow-x) - 78%);36background: linear-gradient(145deg, #ffbe91, #f97316 43%, #7a2808);37}38.whats-new-glow-blue {39left: calc(var(--glow-x) - 30%);40background: linear-gradient(145deg, #77e1e6, #2187d7 45%, #192b8a);41}42.whats-new-button:hover .whats-new-glow, .whats-new-button:focus-visible .whats-new-glow {43transform: translateY(-19px);44opacity: 1;45}46.whats-new-button:focus-visible {47outline: 2px solid #f97316;48outline-offset: 3px;49}