UseMultiColorOptions
Options for useMultiColor.
import type { UseMultiColorOptions } from '@pbroom/color-kit/react';use-multi-color.ts:38interface UseMultiColorOptions {
defaultColors?: MultiColorInput;
defaultSelectedId?: string;
defaultGamut?: GamutTarget;
defaultView?: ViewModel;
state?: MultiColorState;
onChange?: (event: MultiColorUpdateEvent) => void;
}Properties
- defaultColors?
MultiColorInputdefaultone entry, `color-1`, set to `{ l: 0.6, c: 0.2, h: 250, alpha: 1 } - Initial entries in uncontrolled mode, as an
{ id: color }record or an[{ id, color }]array (colors as CSS strings or OKLCH objects). Duplicate ids keep the first entry. - defaultSelectedId?
string - Initially selected entry id; falls back to the first entry when missing or unknown.
- defaultGamut?
GamutTargetdefault'display-p3' - Initial active display gamut shared by all entries.
- defaultView?
ViewModeldefault'oklch' - Initial active view model shared by all entries.
- state?
MultiColorState - Controlled collection state.
- onChange?
(event: MultiColorUpdateEvent) => void - Called when an operation produces a new collection state. Fires synchronously inside the operation call (i.e. in your event handler, before React re-renders) in both controlled and uncontrolled modes, exactly once per effective update and never for no-op updates. Several calls in one tick compose: each
event.nextbuilds on the previous one, even in controlled mode before the newstateprop arrives. Once React re-renders, later calls start from thestateyou committed, so an update you ignore is not carried into the next one.