Skip to content
← UI Library

Glowing border cards

A card grid whose borders light up around the pointer, so nearby cards glow together.

Svelte 5 · Version 1.0.0 · Zero extra packages

Connect MCP

Live preview

Design decision

The shared glow makes a grid feel like one surface and rewards exploration without moving the content. Original Svelte 5 implementation. No code was copied from the inspiring component.

Inspired by Glowing Effect by @manuarora700 on 21st.dev ↗

Source and integration

Pass cards with title, description and an SVG path for the icon (24 x 24 stroke icon). Map --ui-accent to change the glow colour.

You may copy and adapt this original SaaSCrisp implementation in personal and commercial websites.

GlowingCards.svelte
<script lang="ts">
	type Card = { title: string; description: string; icon: string };
	let { cards }: { cards: Card[] } = $props();

	let elements: HTMLElement[] = $state([]);
	let hovering = $state(false);

	function onpointermove(event: PointerEvent) {
		hovering = true;
		for (const element of elements) {
			if (!element) continue;
			const box = element.getBoundingClientRect();
			element.style.setProperty('--x', `${event.clientX - box.left}px`);
			element.style.setProperty('--y', `${event.clientY - box.top}px`);
		}
	}
</script>

<div class="gc" class:hovering role="presentation" {onpointermove} onpointerleave={() => (hovering = false)}>
	{#each cards as card, index (card.title)}
		<article bind:this={elements[index]}>
			<span class="gc-icon" aria-hidden="true">
				<svg viewBox="0 0 24 24"><path d={card.icon} /></svg>
			</span>
			<h3>{card.title}</h3>
			<p>{card.description}</p>
		</article>
	{/each}
</div>

<style>
	.gc {
		--_bg: var(--ui-bg, #0d0d0f);
		--_border: var(--ui-border, rgb(255 255 255 / 0.08));
		--_text: var(--ui-text, #ededf0);
		--_muted: var(--ui-muted, #8b8b94);
		--_accent: var(--ui-accent, #c8ff3c);
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
		gap: 12px;
		font-family: var(--ui-font, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif);
	}
	article {
		--x: -500px;
		--y: -500px;
		position: relative;
		padding: 22px;
		border: 1px solid var(--_border);
		border-radius: 16px;
		background: var(--_bg);
	}
	article::before,
	article::after {
		content: '';
		position: absolute;
		border-radius: inherit;
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.4s;
	}
	article::before {
		inset: -1px;
		padding: 1px;
		background: radial-gradient(260px circle at var(--x) var(--y), var(--_accent), transparent 45%);
		mask:
			linear-gradient(#000 0 0) content-box exclude,
			linear-gradient(#000 0 0);
	}
	article::after {
		inset: 0;
		background: radial-gradient(360px circle at var(--x) var(--y), rgb(255 255 255 / 0.05), transparent 45%);
	}
	.hovering article::before,
	.hovering article::after {
		opacity: 1;
	}
	.gc-icon {
		display: grid;
		place-items: center;
		width: 38px;
		height: 38px;
		border: 1px solid var(--_border);
		border-radius: 10px;
		background: linear-gradient(180deg, rgb(255 255 255 / 0.08), rgb(255 255 255 / 0.02));
		color: var(--_text);
	}
	.gc-icon svg {
		width: 18px;
		height: 18px;
		fill: none;
		stroke: currentColor;
		stroke-width: 1.8;
		stroke-linecap: round;
		stroke-linejoin: round;
	}
	h3 {
		margin: 28px 0 0;
		color: var(--_text);
		font-size: 16px;
		font-weight: 600;
		letter-spacing: -0.01em;
	}
	p {
		margin: 6px 0 0;
		color: var(--_muted);
		font-size: 14px;
		line-height: 1.55;
	}
</style>
Agent prompt

Use the SaaSCrisp UI Library MCP at https://www.saascrisp.com/api/library/mcp. Retrieve glowing-cards version 1.0.0 for svelte with get_ui_asset. Preview: https://www.saascrisp.com/library/glowing-cards. Confirm the project's stack, reuse local primitives and map CSS variables to existing design tokens. Integrate the files and run the project's checks. Report changed files and additional dependencies.