Heatmap
Installation
npm i @paper-design/shaders-react
Code
import { Heatmap } from '@paper-design/shaders-react';
<Heatmap
colors={["#cc3333", "#cc9933", "#99cc33", "#33cc33", "#33cc99", "#3399cc", "#3333cc"]}
>
<div className="demo">
<style>{`.demo { display: grid; align-content: center; justify-items: start; gap: 48px; height: 100%; padding: 0 8%; color: #222 }
.demo p { margin: 0; font: 300 120px/1.1 Matter, system-ui; font-feature-settings: "ss01"; word-spacing: 0.1em; text-transform: lowercase }
.demo button { display: flex; align-items: center; height: 128px; padding: 0 40px; border: 3px solid rgb(0 0 0 / 20%); border-radius: 24px; font: 44px 'Paper Mono', ui-monospace, monospace; color: #222; background: #fff; transition: background-color 150ms cubic-bezier(0.685, 0.89, 0.315, 0.995) }
.demo button:hover { background: #f0efe4 }
.demo button:active { background: #e9e8e0 }
.demo .logos { display: flex; align-items: center; gap: 40px }
.demo .logos img { height: 80px; width: auto }`}</style>
<p>Select this text</p>
<div className="logos">
<img src="/images/logos/paper-logo-only.svg" alt="Paper logo" />
<img src="/apple-touch-icon.png" alt="Paper icon" />
</div>
<button
onClick={(event) => {
const clicks = Number(event.currentTarget.dataset.clicks ?? 0) + 1;
event.currentTarget.dataset.clicks = String(clicks);
event.currentTarget.textContent = `clicked ${clicks} time${clicks === 1 ? '' : 's'}`;
}}
>
hover and click me
</button>
</div>
</Heatmap>
Shader Props
Common Props
Description
A glowing gradient of colors flowing through an input shape. The effect creates a smoothly animated wave of intensity across the image. With default colors, it shifts from cool blues to hot reds, like thermal energy radiating through the shape.