Components

EyeDropper

Pick colors from anywhere on the screen using the browser's native eye dropper tool

Overview

The ColorPicker.EyeDropper component lets users pick colors from anywhere on the screen using the browser's native eye dropper tool.

Basic Usage

Eye Dropper

Selected Color: #ff6b9c
import { ColorPicker, useColorState } from 'react-beautiful-color';
import { Pipette } from 'lucide-react';

export function EyeDropperExample() {
  const [{ colorInput, colorState }, setColor] = useColorState({ 
    type: 'hex', 
    value: '#ff6b9d' 
  });

  return (
    <div className="flex items-center gap-4">
      <ColorPicker color={colorInput} onChange={setColor}>
        <ColorPicker.EyeDropper>
          <Pipette size={20} />
        </ColorPicker.EyeDropper>
      </ColorPicker>

      {/* Show selected color */}
      <div 
        className="w-16 h-16 rounded border"
        style={{ backgroundColor: colorState.hex }}
      />
    </div>
  );
}

Props

PropTypeDefaultDescription
classNamestring-Additional CSS classes
childrenReact.ReactNode-Icon or content

Browser Support

Only renders when the browser supports the EyeDropper API (Chrome 95+, Edge 95+, Safari 17+).