Pickers & inputs JS behaviour

Gradient studio

A small design-tool bench for gradients: a live preview bar, colour stops you add and remove, a draggable angle and a CSS output that copies in one click. Composed from this package’s own components.

Real scenarios

The component as it is used in a product — not a specimen grid.

The gradient bench

Design-tool chrome, built only from this package: the precision slider, buttons and copy feedback. Stops sort themselves by position; the CSS follows every move and copies on click.

background: linear-gradient(135deg, #5647e6 0%, #22d3ee 55%, #f4a93c 100%);
Shape
Angle 135°

Important props

Important props
Prop Type Default What it does
x-data (stops) array [] Each stop: color and pos (0–100). Owned outside; this demo is a composition.
angle number 135 The linear gradient’s angle; set with the precision slider.
kind string 'linear' linear · radial · conic.

Snippet

<div x-data="{
    stops: [{ color: '#5647e6', pos: 0 }, { color: '#f4a93c', pos: 100 }],
    angle: 135, kind: 'linear',
    get css() {
        const list = [...this.stops].sort((a, b) => a.pos - b.pos)
            .map(s => `${s.color} ${s.pos}%`).join(', ');
        return this.kind === 'linear' ? `linear-gradient(${this.angle}deg, ${list})`
            : this.kind === 'radial' ? `radial-gradient(circle, ${list})`
            : `conic-gradient(from ${this.angle}deg, ${list})`;
    },
}">
    <div x-bind:style="`background: ${css}`" style="block-size: 6rem; border-radius: 1rem"></div>
    {{-- stop rows, the precision slider for the angle, and the copy button --}}
</div>