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

Function ColorField

starters/hooks/src/ColorField.tsx:14–38  ·  view source on GitHub ↗
(props: ColorFieldProps)

Source from the content-addressed store, hash-verified

12}
13
14export function ColorField(props: ColorFieldProps) {
15 let state = useColorFieldState(props);
16 let inputRef = useRef<HTMLInputElement>(null);
17 /*- begin highlight -*/
18 let {labelProps, inputProps} = useColorField(props, state, inputRef);
19 /*- end highlight -*/
20 let [isFocused, setFocused] = useState(false);
21 let {focusProps} = useFocus({onFocusChange: setFocused});
22
23 return (
24 <div className="react-aria-ColorField">
25 {props.label && (
26 <label className="react-aria-Label" {...labelProps}>
27 {props.label}
28 </label>
29 )}
30 <input
31 {...mergeProps(inputProps, focusProps)}
32 ref={inputRef}
33 className="react-aria-Input inset"
34 data-focused={isFocused || undefined}
35 />
36 </div>
37 );
38}

Callers

nothing calls this directly

Calls 4

useColorFieldStateFunction · 0.90
useColorFieldFunction · 0.90
useFocusFunction · 0.90
mergePropsFunction · 0.90

Tested by

no test coverage detected