ColorWheel
Circular hue selector
Source
LLM docs
Docs
Package
Usage
ColorWheel is a circular hue selector. Its value is a hue in degrees, a number between 0 and 360:
Controlled
Convert the value to a color with the hsl(hue, 100%, 50%) syntax or with any color conversion function:
Hue: 210°
The value starts at the top of the ring (0° is red) and increases clockwise:
90° is on the right, 180° at the bottom, 270° on the left.
Ring colors
Use saturation and lightness props (numbers between 0 and 100) to change the ring colors.
These props change only the appearance, the value is always the hue in degrees:
saturation=100 lightness=50
saturation=60 lightness=70
Size and thickness
Use size prop to change the outer diameter of the wheel and thickness prop to
change the ring width. The thumb size is calculated from thickness, use thumbSize
prop to override it.
onChangeEnd
The onChangeEnd callback fires when the user stops dragging the wheel or changes its value
with the keyboard. Use it as a debounced callback to prevent frequent updates:
Current value: 0
End value: 0
Without thumb indicator
Set withThumbIndicator={false} to hide the thumb. The component stays interactive and
keyboard accessible:
Disabled
The disabled prop disables the component and prevents user interaction:
ColorWheel with uncontrolled forms
Set name prop to include the hue value in the FormData object on form submission.
Use defaultValue prop to set the initial value and hiddenInputProps to pass
additional props to the hidden input.
Accessibility
To make the component accessible for screen readers, set the aria-label prop:
Keyboard interactions when the thumb is focused. Arrow keys wrap around: decreasing from 0 moves to the last step before 360.
Based on use-radial-move
ColorWheel is based on the use-radial-move hook, the same hook
that powers the AngleSlider component. Use this hook to build
a custom radial selector.