「動く枠線カード」は Pro に含まれます。解除するとプレビューが表示されます。
「スポットライトカード」は Pro に含まれます。解除するとプレビューが表示されます。
仕組み
Two decorative layers sit inside each card: a glow (solid colour under a radial mask) and a border light (a radial gradient revealed only on the 1px ring around the card). JS writes the pointer position to CSS variables, throttled with rAF. SpotlightGroup reads every card's position once and writes coordinates relative to each card, so one pointer lights several cards. Scrolling while hovering recomputes.
向いている場面
- Feature cards on a landing page, three or four in a row (use SpotlightGroup).
- Pricing cards and product blocks on a dark theme that need a tactile feel.
- Card grids where it helps to show where the pointer is, such as category entries.
向かない場面
- Mobile: there is no hover, so never rely on the light to convey information.
- Dense admin lists and tables: the effect distracts.
- Cards with gradient, dashed or thick borders: the border light only fits a 1px edge.
使い方
import { SpotlightCard, SpotlightGroup } from './SpotlightCard.jsx'
// A single card
<SpotlightCard size={320} intensity={0.7}>
<h3>Instant sync</h3>
<p>Changes reach every device in 2 seconds</p>
</SpotlightCard>
// In a group: the borders of neighbouring cards light up together
<SpotlightGroup color="#ffffff" style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 12 }}>
{features.map((f) => (
<SpotlightCard key={f.id}>{f.title}</SpotlightCard>
))}
</SpotlightGroup>プロパティ
| プロパティ | 型 | 既定値 | 説明 |
|---|---|---|---|
size | number | 320 | Spot diameter in px. Cards inside a SpotlightGroup inherit the group's value. |
intensity | number | 0.7 | Strength from 0 to 1. Controls the glow (× 0.3) and the border light. |
color | string | 'var(--ds-accent)' | Colour of the light. White works best on dark backgrounds. |
children | ReactNode | — | Card content. By default the card has 20px padding, a 24px radius and no border: a hairline ring and a soft shadow (--ds-shadow-card) lift it, and the border light runs on that ring. Override with className or style. |
...rest | HTMLAttributes<HTMLDivElement> | — | Other attributes go to the root <div> (same for SpotlightCard and SpotlightGroup). |
アクセシビリティ
- Both light layers are aria-hidden decoration and do not affect screen readers or the keyboard.
- Only mouse and pen respond; touch screens (hover: none) show nothing.
- The light changes brightness only, with no movement, so it stays on under reduced motion; content contrast never depends on it.
モーション
Lights up in 160ms ease-out and fades in 360ms standard; pointer following is throttled to one update per frame.
プロジェクトに追加
Pro メンバーはプロンプトをコピーし、コーディングエージェントが無料コンポーネントと同じ手順でソースを導入します。
SpotlightCard.jsxspotlight-card.csstokens.cssREADME.md
2 つのファイルを一緒に導入します。スタイルは tokens.css の変数を読み、予備の値も持つため、単体でも表示できます。
同じカテゴリ
カード「ビームボーダー」は Pro に含まれます。解除するとプレビューが表示されます。
「カード詳細とロック」は Pro に含まれます。解除するとプレビューが表示されます。







