# Spotlight

> A soft light that follows the pointer across a container and catches the borders of the cards inside it.

Source: https://www.honestui.com/docs/animated/spotlight

```tsx
import { Database, Globe, Lock, Zap } from "honestui/icons";

import { Spotlight, SpotlightCard } from "@/registry/default/animated/spotlight";

const cards = [
  { icon: Zap, title: "Edge functions", detail: "Run code within 50 ms of every user." },
  { icon: Database, title: "Managed storage", detail: "Postgres and blobs, backed up nightly." },
  { icon: Lock, title: "Access control", detail: "Roles, SSO, and audit logs built in." },
  { icon: Globe, title: "Global CDN", detail: "Assets cached in over 100 regions." },
];

export function SpotlightDemo() {
  return (
    <Spotlight className="grid w-full max-w-xl grid-cols-1 gap-3 sm:grid-cols-2">
      {cards.map(({ icon: Icon, title, detail }) => (
        <SpotlightCard key={title} className="p-4">
          <span className="grid size-8 place-items-center rounded-lg border border-border text-muted-foreground">
            <Icon className="size-4" />
          </span>
          <h3 className="mt-4 text-sm font-semibold tracking-tight text-foreground">{title}</h3>
          <p className="mt-1 text-[13px] leading-5 text-muted-foreground">{detail}</p>
        </SpotlightCard>
      ))}
    </Spotlight>
  );
}

```

## Overview [#overview]

Spotlight adds a quiet glow under the pointer as it moves across a container. Cards inside it, rendered with `SpotlightCard`, light up along the part of their border nearest the pointer, even before the pointer reaches them, so a grid of cards reads as one lit surface. It suits feature grids, pricing tiers, and dashboards where a little depth helps without moving anything.

The surface glow follows the pointer with a light spring. Card borders update once per frame from a single listener on the container, so a large grid does not attach a handler to every card. Set `glow={false}` to light only the card borders.

## Installation [#installation]

<CliBlock commands="[&#x22;spotlight&#x22;]" />

## Usage [#usage]

```tsx
import { Spotlight, SpotlightCard } from "@/components/animated/spotlight"

<Spotlight className="grid grid-cols-2 gap-3">
  <SpotlightCard className="p-4">Edge functions</SpotlightCard>
  <SpotlightCard className="p-4">Managed storage</SpotlightCard>
</Spotlight>
```

Colors accept any CSS color, including `color-mix()` and variables. The defaults are tints of `--foreground`, so the light works in both themes.

## Accessibility [#accessibility]

The light is decorative and hidden from assistive technology; the cards and their content are unchanged. It responds only to a mouse or trackpad: on touch devices and when the user prefers reduced motion, the cards render as plain bordered cards. Do not rely on the light to show focus or selection; style those states on the cards themselves.

## API Reference [#api-reference]

### Spotlight [#spotlight]


  ### `size`

type: `number` · default: `420`

Diameter of the light in px.

  ### `color`

type: `string`

Glow color on the container surface.

  ### `borderColor`

type: `string`

Color of the light on card borders. Defaults to 

    `--foreground`

     at 60%.

  ### `cardColor`

type: `string`

Faint fill inside a card under the pointer.

  ### `glow`

type: `boolean` · default: `true`

Show the glow on the container surface.

  ### `className`

type: `string`

Classes for the container, such as its grid layout.


### SpotlightCard [#spotlightcard]


  ### `className`

type: `string`

Classes for the card. It has a border, a card background, and rounded corners by default.
