MCPcopy Index your code
hub / github.com/adobe/react-spectrum / FocusRing

Function FocusRing

packages/react-aria/src/focus/FocusRing.tsx:44–61  ·  view source on GitHub ↗
(
  props: FocusRingProps
)

Source from the content-addressed store, hash-verified

42 * not with a mouse, touch, or other input methods.
43 */
44export function FocusRing(
45 props: FocusRingProps
46): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> {
47 let {children, focusClass, focusRingClass} = props;
48 let {isFocused, isFocusVisible, focusProps} = useFocusRing(props);
49 let child = React.Children.only(children);
50
51 return React.cloneElement(
52 child,
53 mergeProps(child.props as any, {
54 ...focusProps,
55 className: clsx({
56 [focusClass || '']: isFocused,
57 [focusRingClass || '']: isFocusVisible
58 })
59 })
60 );
61}

Callers

nothing calls this directly

Calls 3

useFocusRingFunction · 0.90
mergePropsFunction · 0.90
clsxFunction · 0.50

Tested by

no test coverage detected