ColorProps
Props for Color: the UseColorOptions plus children.
import type { ColorProps } from '@pbroom/color-kit/react';color.tsx:6interface ColorProps extends UseColorOptions {
children: ReactNode;
defaultColor?: string | Color;
state?: ColorState;
onChange?: (event: ColorUpdateEvent) => void;
defaultGamut?: GamutTarget;
defaultView?: ViewModel;
}Properties
- children
ReactNode - Color components that share this provider's state.
- defaultColor?
string | Colordefault{ l: 0.6, c: 0.2, h: 250, alpha: 1 } - Initial requested color in uncontrolled mode: any CSS color string
parseaccepts, or an OKLCHColorobject. Ignored whenstateis set. - state?
ColorState - Controlled full state. When set, the hook renders this state and reports updates through
onChangeinstead of storing them. - onChange?
(event: ColorUpdateEvent) => void - Called when a setter produces a new state. Fires synchronously inside the setter 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 setter 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. - defaultGamut?
GamutTargetdefault'display-p3' - Initial active display gamut in uncontrolled mode.
- defaultView?
ViewModeldefault'oklch' - Initial active view model in uncontrolled mode.