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

Function Button

starters/hooks/src/Button.tsx:19–39  ·  view source on GitHub ↗
({variant = 'primary', ...props}: ButtonProps)

Source from the content-addressed store, hash-verified

17}
18
19export function Button({variant = 'primary', ...props}: ButtonProps) {
20 let ref = useRef<HTMLButtonElement>(null);
21 let {buttonProps, isPressed} = useButton(props, ref);
22 let {hoverProps, isHovered} = useHover(props);
23 let {focusProps, isFocusVisible} = useFocusRing();
24
25 return (
26 <button
27 {...mergeProps(buttonProps, hoverProps, focusProps)}
28 ref={ref}
29 slot={props.slot}
30 className="react-aria-Button button-base"
31 data-variant={variant}
32 data-pressed={isPressed || undefined}
33 data-hovered={isHovered || undefined}
34 data-focus-visible={isFocusVisible || undefined}
35 data-disabled={props.isDisabled || undefined}>
36 {props.children}
37 </button>
38 );
39}

Callers

nothing calls this directly

Calls 4

useButtonFunction · 0.90
useHoverFunction · 0.90
useFocusRingFunction · 0.90
mergePropsFunction · 0.90

Tested by

no test coverage detected