@@ -85,6 +85,50 @@ function Demo() {
85
85
);
86
86
}
87
87
88
+ export default Demo ;
89
+ ```
90
+ ### Custom Pointer
91
+
92
+ ``` tsx mdx:preview
93
+ import React , { useState , Fragment } from ' react' ;
94
+ import Wheel from ' @uiw/react-color-wheel' ;
95
+ import ShadeSlider from ' @uiw/react-color-shade-slider' ;
96
+ import { hsvaToHex } from ' @uiw/color-convert' ;
97
+
98
+ function Demo() {
99
+ const [hsva, setHsva] = useState ({ h: 214 , s: 43 , v: 90 , a: 1 });
100
+ return (
101
+ <Fragment >
102
+ <Wheel color = { hsva } onChange = { (color ) => setHsva ({ ... hsva , ... color .hsva })}
103
+ /* Passing the style prop is required in the topmost element. */
104
+ pointer = { ({ color , style }) => {
105
+ return (
106
+ <div style = { style } >
107
+ <div
108
+ style = { {
109
+ width: 12 ,
110
+ height: 12 ,
111
+ transform: ' translate(-5px, -5px)' ,
112
+ backgroundColor: color ,
113
+ border: ' 1px solid #000' ,
114
+ }}
115
+ ></div >
116
+ </div >
117
+ );
118
+ }}
119
+ />
120
+ <ShadeSlider
121
+ hsva = { hsva }
122
+ style = { { width: 210 , marginTop: 20 }}
123
+ onChange = { (newShade ) => {
124
+ setHsva ({ ... hsva , ... newShade });
125
+ }}
126
+ />
127
+ <div style = { { width: ' 100%' , height: 34 , marginTop: 20 , background: hsvaToHex (hsva ) }} ></div >
128
+ </Fragment >
129
+ );
130
+ }
131
+
88
132
export default Demo ;
89
133
```
90
134
@@ -107,7 +151,8 @@ export interface WheelProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
107
151
angle? : number ;
108
152
/** Direction of the color wheel's hue gradient; either clockwise or anticlockwise. Default: `anticlockwise` */
109
153
direction? : ' clockwise' | ' anticlockwise' ;
110
- pointer? : ({ prefixCls, left, top, color }: PointerProps ) => JSX .Element ;
154
+ /** Passing the style prop is required in the topmost element. */
155
+ pointer? : ({ color, style }: PointerProps ) => JSX .Element ;
111
156
onChange? : (color : ColorResult ) => void ;
112
157
}
113
158
declare const Wheel: React .ForwardRefExoticComponent <WheelProps & React .RefAttributes <HTMLDivElement >>;
0 commit comments