A card whose edge lights up in blue where the pointer is, with a soft light inside. Good for a row of services or prices.
How to use
Make two files in your project's components folder: spotlight-card.tsx and spotlight-card.module.css.
Paste the code into each one, keeping the licence note at the top of the component.
It needs nothing beyond React. Your project needs CSS Modules, which Next.js and Vite already have.
Import it where you want it, then change the words, colours and sizes to yours.
The code
"use client";
import { useCallback, useEffect, useRef, type CSSProperties, type PointerEvent as ReactPointerEvent, type ReactNode } from "react";
import styles from "./spotlight-card.module.css";
interface SpotlightCardProps {
children?: ReactNode;
/** Put the corner radius here; the card inherits it. */
className?: string;
/** Size of the light in pixels. */
gradientSize?: number;
/** Colour of the light inside the card. */
This comes with paid plans
The code for every component comes with paid plans, along with the rest of the AI toolkit. The first component under each heading is free.
"use client";
import { useCallback, useEffect, useRef, type CSSProperties, type PointerEvent as ReactPointerEvent, type ReactNode } from "react";
import styles from "./spotlight-card.module.css";
interface SpotlightCardProps {
children?: ReactNode;
/** Put the corner radius here; the card inherits it. */
className?: string;
/** Size of the light in pixels. */
gradientSize?: number;
/** Colour of the light inside the card. */
This comes with paid plans
The code for every component comes with paid plans, along with the rest of the AI toolkit. The first component under each heading is free.