Playground

Spotlight

A surface with a soft highlight that follows the pointer.

  • Built on native elements
  • Pointer only and purely visual: no keyboard behaviour depends on it, and the glow is a pseudo-element that is never read aloud.
  • Content keeps its normal order and focus ring; the glow only appears for hover-capable pointers.
  • No fade transition under prefers-reduced-motion.
  • Styles in one file: spotlight.css

Import

import '@monoline/css';
import {Spotlight} from '@monoline/react';

Not installed yet? Pick a route.

Copies the source and its styles into your project.

npx monoline add spotlight

Usage

import {Spotlight} from '@monoline/react';

<Spotlight style={{padding: 'var(--s7)', border: '1px solid var(--rule)', maxWidth: '28rem'}}>
  <h3 style={{margin: 0, fontWeight: 500}}>Hover here</h3>
  <p style={{margin: 'var(--s2) 0 0', color: 'var(--muted)'}}>A soft light follows the pointer. Keyboard and touch see a plain surface.</p>
</Spotlight>

Examples

Card

Move the pointer over it.

Larger glow

Props

SpotlightProps

PropTypeDefaultDescription
sizenumber240Radius of the glow in px. Default 240.

Data Attributes

State is exposed through attributes. Style it with these selectors, not with class toggles.

This component sets no state attributes.

CSS classes

ClassStylesheet
.spotlightspotlight.css

Customization

Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.

app.css
.spotlight {
  border-color: var(--accent);
}

Accessibility

  • Pointer only and purely visual: no keyboard behaviour depends on it, and the glow is a pseudo-element that is never read aloud.
  • Content keeps its normal order and focus ring; the glow only appears for hover-capable pointers.
  • No fade transition under prefers-reduced-motion.