Hewn
Components

Components

ColorPicker

Composable color picker with area, hue and alpha sliders, hex field, and swatch presets.

newfree

Install

@hewnui/ui · hewnui

Terminal
npm install @hewnui/ui
Terminal
pnpm add @hewnui/ui
Terminal
yarn add @hewnui/ui
Terminal
bun add @hewnui/ui
Terminal
npx hewnui@latest add color-picker

ColorPicker synchronizes React Aria ColorArea, ColorSlider, ColorField, and swatch presets. Returns a hex string and can show a read-only OKLCH readout. Lives under Pickers in the component gallery.

OKLCHoklch(51.1% 0.086 186.4)
Hex edits the value; OKLCH is display-only.

Usage

TSX
import { ColorPicker } from "@hewnui/ui";

<ColorPicker label="Brand accent" defaultValue="#1a6b4a" />

Inline panel

TSX
<ColorPicker
  label="Fill color"
  variant="inline"
  showOklch
  description="Hex is editable; OKLCH is display-only."
/>

Presets and alpha

TSX
<ColorPicker
  label="Opaque only"
  showAlpha={false}
  presets={["#1a6b4a", "#0f766e", "#b45309", "#334155"]}
/>

Accessibility

  • Labeled saturation/brightness area, hue slider, and alpha slider
  • Hex field for precise entry
  • Keyboard navigation across area, sliders, field, and swatches
  • Hidden name input for HTML form submission

API reference

Props for ColorPicker from @hewnui/ui/color-picker. Generated from component types — not hand-written.

Prop

Type

On this page