Forms v1.0.0

Color Picker

Color selection input with hue/saturation pad, sliders, preset swatches, and hex/rgb input. Supports alpha channel and compact popover mode. Includes a draggable saturation/lightness canvas, hue rainbow slider, optional alpha slider, manual hex input, and clickable preset color swatches. Works standalone or in compact mode as a small color swatch trigger.

Preview & Code

Options

Name Type Default Description
value String "#3b82f6" Initial hex color value
label String nil Label text displayed above the picker
hint String nil Help text displayed below the picker
swatches Array [] Array of hex color strings for preset swatches. Defaults to a built-in palette when empty.
format Symbol :hex Output format: :hex, :rgb, or :hsl
alpha Boolean false Show alpha/opacity slider
show_input Boolean true Show text input for manual hex entry
disabled Boolean false Disable the entire color picker
error String nil Error message displayed below the picker
name String nil Name attribute for the hidden form input
compact Boolean false Compact mode — renders a small swatch trigger that opens the picker as a popover

Changelog v1.0.0

- Initial release with saturation/lightness pad and hue slider
- Optional alpha channel slider
- Preset color swatches with active state ring
- Manual hex input with validation
- Compact popover mode
- Dark mode support throughout
- Hidden form input for Rails form integration

Get Full Access

Unlock the source code for this component and all others. One-time payment for lifetime access.

Get Access Now