Open this example in the interactive library
Live preview
Source code
// components/GradientAngleDial.tsx
import { useState } from "react";
export default function GradientAngleDial({ hex = "#bc805a" }: { hex?: string } = {}) {
const [deg, set] = useState(45);
return (
<label>
Angle {deg}°
<input
type="range"
max={360}
value={deg}
onChange={(e) => set(+e.target.value)}
/>
<span
style={{
display: "block",
height: 80,
background: "linear-gradient(" + deg + "deg," + hex + ",white)",
}}
/>
</label>
);
}
