Skip to content
OTF Kit logoOTF Kit

Color Picker

Input

Inline color picker with HEX / RGB / HSL formats, optional alpha + swatches, and native eye-dropper.

View in Storybook
Color Picker
Loading Storybook preview…

Installation

bun add @otfdashkit/ui

Usage

Import ColorPicker from @otfdashkit/ui.

Code
// Color Picker — Inline color picker with HEX / RGB / HSL formats, optional alpha + swatches, and native eye-dropper.
//
// Install:
//   bun add @otfdashkit/ui

import { ColorPicker } from '@otfdashkit/ui'

export function Example() {
  return (
    <ColorPicker>
      {/* your content */}
    </ColorPicker>
  )
}

Props

Props declared in the ColorPicker source. Inherited HTML attributes are not listed.

PropTypeDefaultDescription
defaultValuestring | (readonly string[] & string)Uncontrolled initial value.
disabledbooleanfalseDisable interaction.
format'hex' | 'rgb' | 'hsl''hex'Format for the text input + picker. Default 'hex'.
onValueChange(value: string) => voidFires whenever the color changes.
showAlphabooleanfalseInclude alpha channel (only meaningful for hex). Default false.
showEyeDropperbooleantrueShow the eye-dropper button when the API is available. Default true.
swatchesstring[]Optional preset palette displayed as clickable swatches.
valuestringControlled color value (e.g. '#3b82f6' for hex, 'rgb(59, 130, 246)' for rgb).

Related