Vanilla Breeze

gradient-builder

Interactive CSS gradient builder with color stops, angle control, interpolation space selection, and one-click CSS export.

Overview

The <gradient-builder> component creates interactive CSS gradients with a live preview strip, color stop management, angle and type controls, and color space selection. Export the result as a CSS linear-gradient() or radial-gradient() value. Part of the Design System Pack tooling.

Attributes

AttributeTypeDefaultDescription
colorsstring#6366f1,#ec4899Comma-separated initial stop colors
typestringlinearlinear or radial
anglenumber90Gradient angle in degrees (linear only)
interpolationstringoklabColor space: oklab, oklch, srgb
show-exportbooleanShow Copy CSS toolbar
show-controlsbooleantrueShow type, angle, and space controls

Events

EventDetailWhen
gradient-builder:change{ css, stops, type, angle, interpolation }Any control changes

Color Spaces

The interpolation dropdown controls which color space the browser uses to blend between stops:

  • oklab (default) — perceptually uniform, avoids muddy mid-tones. Best for most gradients.
  • oklch — perceptually uniform in polar coordinates, produces vibrant hue shifts.
  • sRGB — traditional browser interpolation. Can produce desaturated mid-tones.

Examples

Design System Workflow

Use the gradient builder alongside the Palette Generator to explore color relationships:

  1. Generate a palette from a seed color
  2. Use palette colors as gradient stops
  3. Adjust the angle and color space for the desired effect
  4. Copy the CSS and paste into your theme or component styles