Color Picker
An HSV-based color picker with hue and alpha sliders, hex/RGB inputs, custom swatches, and three trigger styles.
Basic Usage
Default Color Picker
Click the trigger to open the picker. Supports hex, RGB, and alpha editing.
import { ColorPicker } from 'fluxo-ui';
const [color, setColor] = useState('#3b82f6');
<ColorPicker value={color} onChange={setColor} />
<ColorPicker defaultValue="#22c55e" />
<ColorPicker defaultValue="#f43f5e" showAlpha={false} />Trigger Variants
Trigger Variants
Three trigger styles: button (icon + text), input (monospace code), and swatch (color-only).
<ColorPicker variant="button" defaultValue="#3b82f6" />
<ColorPicker variant="input" defaultValue="#22c55e" />
<ColorPicker variant="swatch" defaultValue="#f59e0b" />Sizes
Sizes
Three trigger sizes.
<ColorPicker size="sm" defaultValue="#3b82f6" />
<ColorPicker size="md" defaultValue="#3b82f6" />
<ColorPicker size="lg" defaultValue="#3b82f6" />Formats
Output Formats
Display the current value in hex, rgb, or rgba format.
<ColorPicker defaultValue="#3b82f6" format="hex" />
<ColorPicker defaultValue="#22c55e" format="rgb" />
<ColorPicker defaultValue="#f59e0b" format="rgba" />Swatches & Panels
Custom Swatches & Panel Toggles
Pass your own palette via the swatches prop, or hide input fields and swatches for a minimal picker.
<ColorPicker
defaultValue="#3b82f6"
swatches={['#0f172a', '#1e293b', '#3b82f6', '#60a5fa', '#fb923c']}
/>
<ColorPicker defaultValue="#3b82f6" showSwatches={false} />
<ColorPicker defaultValue="#3b82f6" showInputs={false} showSwatches={false} />Import
import { ColorPicker } from 'fluxo-ui';
import type { ColorPickerProps } from 'fluxo-ui';Props
valuestringControlled hex color value.
valuestringControlled hex color value.
defaultValuestring"'#3b82f6'"Initial hex color for uncontrolled usage.
defaultValuestring"'#3b82f6'"Initial hex color for uncontrolled usage.
alphanumberControlled alpha value between 0 and 1.
alphanumberControlled alpha value between 0 and 1.
defaultAlphanumber"1"Initial alpha value.
defaultAlphanumber"1"Initial alpha value.
format'hex' | 'rgb' | 'rgba'"'hex'"Format used for the displayed trigger text.
format'hex' | 'rgb' | 'rgba'"'hex'"Format used for the displayed trigger text.
size'sm' | 'md' | 'lg'"'md'"Trigger size.
size'sm' | 'md' | 'lg'"'md'"Trigger size.
variant'button' | 'input' | 'swatch'"'button'"Trigger visual style.
variant'button' | 'input' | 'swatch'"'button'"Trigger visual style.
disabledboolean"false"Disable interaction.
disabledboolean"false"Disable interaction.
readOnlyboolean"false"Display-only mode.
readOnlyboolean"false"Display-only mode.
editableboolean"false"When used with variant='input', renders a real text input so users can type a hex code manually. Valid hex updates the color live.
editableboolean"false"When used with variant='input', renders a real text input so users can type a hex code manually. Valid hex updates the color live.
showAlphaboolean"true"Show the alpha slider and input.
showAlphaboolean"true"Show the alpha slider and input.
showInputsboolean"true"Show hex/RGB/alpha input fields.
showInputsboolean"true"Show hex/RGB/alpha input fields.
showSwatchesboolean"true"Show the preset swatches grid.
showSwatchesboolean"true"Show the preset swatches grid.
swatchesstring[]Custom palette of hex swatches.
swatchesstring[]Custom palette of hex swatches.
placeholderstring"'Pick a color'"ARIA label when none is provided.
placeholderstring"'Pick a color'"ARIA label when none is provided.
onChange(value: string, alpha: number) => voidCalled when the color or alpha changes.
onChange(value: string, alpha: number) => voidCalled when the color or alpha changes.
onOpenChange(open: boolean) => voidCalled when the popover opens or closes.
onOpenChange(open: boolean) => voidCalled when the popover opens or closes.
Features
HSV Canvas
Click-and-drag saturation/value canvas with separate hue and alpha sliders.
Multiple Formats
Display and emit values in hex, rgb, or rgba depending on the format prop.
Custom Swatches
Provide your brand palette or hide swatches entirely for a minimal experience.
Portal Popover
The picker panel renders in a portal with auto-positioning and click-outside dismissal.