Cursor Spotlight Cards
A grid of cards lit by a soft glow that follows the pointer across all of them at once.
AI prompt
Dark UI mockup of a three by two grid of feature cards on a near-black background, a soft white radial glow centred between the top two cards as if lit by a cursor, the border of each card brightest where it is closest to the glow, each card with a small icon, a short title and one line of grey text, rounded corners, fine one-pixel borders, subtle and premium, flat design. Variants: the glow at the far right, and no glow. Negative: neon colours, heavy shadows, text errors, clutter. Reduced motion: static design.About this pattern
Definition
A spotlight grid makes a whole row of cards feel lit by the cursor. Each card draws a radial gradient centred where the pointer is relative to that card, so the light seems to pass across gaps and borders as one beam rather than lighting only the hovered card.
Purpose & UX principles
- Track the pointer on the grid and set per-card custom properties for the offset inside each card.
- Use a low-opacity gradient for the fill and a brighter one on the border using a mask.
- Fade the glow out when the pointer leaves.
Interaction states
- Six cards, an Intensity slider and a Spotlight on/off switch.
Motion specification
- The glow follows the pointer directly and fades out over 250ms.
- Reduced motion: the glow is static at the top left of each card.
Responsive behaviour
- The glow is decoration only; every card must look finished without it.
- On touch devices there is no hover, so show a static soft highlight instead.
Code
<div class="bx"><div class="gr" id="gr"></div><div class="row2"><label class="sw"><input id="on" type="checkbox" checked> Spotlight</label><label class="rw" style="flex:1">Intensity <b id="iv">50%</b><input id="it" type="range" min="10" max="100" value="50"></label></div></div>:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.gr{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;padding:8px;border-radius:12px;background:#0e0e11;--o:.5}.cd{position:relative;border-radius:10px;padding:8px 9px;background:#17171b;color:#e8e8ec;font-size:11.5px;display:grid;gap:3px;border:1px solid #26262c;overflow:hidden}.cd b{font-size:12.5px}.cd span{color:#8a8a94}.cd i{width:16px;height:16px;border-radius:5px;background:#2a2a32;display:block;margin-bottom:2px}
.cd::before,.cd::after{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;opacity:0;transition:opacity .25s}.cd::before{background:radial-gradient(120px circle at var(--x,0) var(--y,0),rgba(255,255,255,calc(var(--o)*.18)),transparent 70%)}.cd::after{padding:1px;background:radial-gradient(100px circle at var(--x,0) var(--y,0),rgba(255,255,255,calc(var(--o)*1.6)),transparent 70%);-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude}
.gr.lit .cd::before,.gr.lit .cd::after{opacity:1}.gr.off .cd::before,.gr.off .cd::after{opacity:0!important}
.row2{display:flex;gap:12px;align-items:end;margin-top:8px}.sw{display:flex;gap:6px;align-items:center;font-size:12px;color:var(--muted)}@media (prefers-reduced-motion:reduce){.cd::before,.cd::after{transition:none}}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}const T=[['Search','Find anything fast'],['Sync','Stay up to date'],['Share','Send with a link'],['Secure','Encrypted by default'],['Automate','Skip repeat work'],['Insights','See what changes']],gr=document.getElementById('gr'),on=document.getElementById('on'),it=document.getElementById('it'),calm=matchMedia('(prefers-reduced-motion:reduce)').matches;
gr.innerHTML=T.map(t=>'<div class="cd"><i></i><b>'+t[0]+'</b><span>'+t[1]+'</span></div>').join('');const cs=[...gr.children];
function lit(e){const x=e.clientX,y=e.clientY;cs.forEach(c=>{const r=c.getBoundingClientRect();c.style.setProperty('--x',(x-r.left)+'px');c.style.setProperty('--y',(y-r.top)+'px');});gr.classList.add('lit');}
if(!calm){gr.addEventListener('pointermove',lit);gr.addEventListener('pointerleave',()=>gr.classList.remove('lit'));}else{gr.classList.add('lit');}
function up(){gr.classList.toggle('off',!on.checked);gr.style.setProperty('--o',it.value/100);document.getElementById('iv').textContent=it.value+'%';}on.addEventListener('change',up);it.addEventListener('input',up);up();One complete HTML file. Save it and open it in a browser.
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Cursor Spotlight Cards — demo</title>
<style>
:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
html,body{height:100%}body{background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif;-webkit-font-smoothing:antialiased}.stage{min-height:100%;display:grid;place-items:center;padding:24px}button,input,select,textarea{font-family:inherit}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.gr{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;padding:8px;border-radius:12px;background:#0e0e11;--o:.5}.cd{position:relative;border-radius:10px;padding:8px 9px;background:#17171b;color:#e8e8ec;font-size:11.5px;display:grid;gap:3px;border:1px solid #26262c;overflow:hidden}.cd b{font-size:12.5px}.cd span{color:#8a8a94}.cd i{width:16px;height:16px;border-radius:5px;background:#2a2a32;display:block;margin-bottom:2px}
.cd::before,.cd::after{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;opacity:0;transition:opacity .25s}.cd::before{background:radial-gradient(120px circle at var(--x,0) var(--y,0),rgba(255,255,255,calc(var(--o)*.18)),transparent 70%)}.cd::after{padding:1px;background:radial-gradient(100px circle at var(--x,0) var(--y,0),rgba(255,255,255,calc(var(--o)*1.6)),transparent 70%);-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude}
.gr.lit .cd::before,.gr.lit .cd::after{opacity:1}.gr.off .cd::before,.gr.off .cd::after{opacity:0!important}
.row2{display:flex;gap:12px;align-items:end;margin-top:8px}.sw{display:flex;gap:6px;align-items:center;font-size:12px;color:var(--muted)}@media (prefers-reduced-motion:reduce){.cd::before,.cd::after{transition:none}}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
</style></head>
<body><div class="stage">
<div class="bx"><div class="gr" id="gr"></div><div class="row2"><label class="sw"><input id="on" type="checkbox" checked> Spotlight</label><label class="rw" style="flex:1">Intensity <b id="iv">50%</b><input id="it" type="range" min="10" max="100" value="50"></label></div></div>
</div>
<script>
const T=[['Search','Find anything fast'],['Sync','Stay up to date'],['Share','Send with a link'],['Secure','Encrypted by default'],['Automate','Skip repeat work'],['Insights','See what changes']],gr=document.getElementById('gr'),on=document.getElementById('on'),it=document.getElementById('it'),calm=matchMedia('(prefers-reduced-motion:reduce)').matches;
gr.innerHTML=T.map(t=>'<div class="cd"><i></i><b>'+t[0]+'</b><span>'+t[1]+'</span></div>').join('');const cs=[...gr.children];
function lit(e){const x=e.clientX,y=e.clientY;cs.forEach(c=>{const r=c.getBoundingClientRect();c.style.setProperty('--x',(x-r.left)+'px');c.style.setProperty('--y',(y-r.top)+'px');});gr.classList.add('lit');}
if(!calm){gr.addEventListener('pointermove',lit);gr.addEventListener('pointerleave',()=>gr.classList.remove('lit'));}else{gr.classList.add('lit');}
function up(){gr.classList.toggle('off',!on.checked);gr.style.setProperty('--o',it.value/100);document.getElementById('iv').textContent=it.value+'%';}on.addEventListener('change',up);it.addEventListener('input',up);up();
</script>
</body></html>