MCPcopy Create free account
hub / github.com/adobe/react-spectrum / ColorPicker

Function ColorPicker

packages/react-aria-components/src/ColorPicker.tsx:58–83  ·  view source on GitHub ↗
(props: ColorPickerProps)

Source from the content-addressed store, hash-verified

56 * It simplifies building color pickers with customizable layouts via composition.
57 */
58export function ColorPicker(props: ColorPickerProps): JSX.Element {
59 let ctx = useSlottedContext(ColorPickerContext, props.slot);
60 props = mergeProps(ctx, props);
61 let state = useColorPickerState(props);
62 let renderProps = useRenderProps({
63 ...props,
64 values: {
65 color: state.color
66 }
67 });
68
69 return (
70 <Provider
71 values={[
72 [ColorPickerStateContext, state],
73 [ColorSliderContext, {value: state.color, onChange: state.setColor}],
74 [ColorAreaContext, {value: state.color, onChange: state.setColor}],
75 [ColorWheelContext, {value: state.color, onChange: state.setColor}],
76 [ColorFieldContext, {value: state.color, onChange: state.setColor}],
77 [ColorSwatchContext, {color: state.color}],
78 [ColorSwatchPickerContext, {value: state.color, onChange: state.setColor}]
79 ]}>
80 {renderProps.children}
81 </Provider>
82 );
83}

Callers

nothing calls this directly

Calls 4

useSlottedContextFunction · 0.90
mergePropsFunction · 0.90
useColorPickerStateFunction · 0.90
useRenderPropsFunction · 0.90

Tested by

no test coverage detected