Gradient Mixer
Drag colour points over a canvas and copy the layered CSS gradient. Free, MIT · Interactive blocks › Small editors and calculators
Editor of a layered background: colour points on a canvas, each a radial CSS layer with its own colour, opacity and two radii. Drag the points or move them with the arrow keys, set exact values in the panel, undo and redo whole actions, and copy CSS built by the same serializer as the preview.
Installation
npx valyro-cli@latest add gradient-mixer
npx shadcn@latest add https://valyro.xyz/r/gradient-mixer.json
npm install valyro-ui
import 'valyro-ui/styles.css';
import { GradientMixer } from 'valyro-ui';
Props
| Prop | Type | Default | |
|---|---|---|---|
value | GradientValue | The composition: a base colour and radial layers, the first one on top. | |
defaultValue | GradientValue | DEFAULT_GRADIENT | Initial composition when uncontrolled. Default: three colour points on a dark base. |
onValueChange | (value: GradientValue) => void | Called with the whole new composition after each change (a drag reports once, when it ends). | |
maxPoints | number | 8 | Most layers. Default 8. |
historyLimit | number | 50 | Most undoable actions. Default 50. |
showControls | boolean | true | Panel with the layer list and exact fields. Default true. |
showExport | boolean | true | The CSS code and its copy button. Default true. |
onExport | (css: string) => void | Called with the CSS when it is copied. | |
aspectRatio | number | string | '16 / 9' | Proportions of the canvas. Default 16 / 9. |
colorPickerLabels | Partial<ColorPickerPopoverLabels> | Texts of the colour pickers inside the editor. | |
labels | Partial<GradientMixerLabels> | Overrides for the built-in English text; keys left out keep their defaults. |
Related components
- Pixel Painter — Draw on a pixel grid and save a PNG
- Crafting Recipe — Recipe card: batches, ingredients needed and what is missing
- Feature Hotspots — Numbered points on an image that open a note about each detail
- Exploded Layers — Prepared image layers pulled apart with captions
- Prediction Card — The reader guesses first, then sees the answer and the explanation
- Detail Dial — Choose how deep an explanation goes: short, detailed or full
- Version Scrubber — Step through prepared versions of a design with one slider
- Page Minimap — Schematic map of a long page with the visible area
- Peel Sticker — A sticker you peel back by its corner to reveal what is under it
- Scratch Reveal — Scratch off a cover to reveal text or a picture
- Tear-off Ticket — A ticket whose stub tears off along the perforation
- Split-Flap Board — Mechanical departure board: only the changed characters flip
Previous: Priority Budget · Next: Pixel Painter · All Interactive blocks