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

Function Button

starters/tailwind/src/Button.tsx:47–86  ·  view source on GitHub ↗
(props: ButtonProps)

Source from the content-addressed store, hash-verified

45});
46
47export function Button(props: ButtonProps) {
48 return (
49 <RACButton
50 {...props}
51 className={composeRenderProps(props.className, (className, renderProps) =>
52 button({...renderProps, variant: props.variant, className})
53 )}>
54 {composeRenderProps(props.children, (children, {isPending}) => (
55 <>
56 {children}
57 {isPending && (
58 <span aria-hidden className="flex absolute inset-0 justify-center items-center">
59 <svg
60 className="w-4 h-4 text-white animate-spin"
61 viewBox="0 0 24 24"
62 stroke={
63 props.variant === 'secondary' || props.variant === 'quiet'
64 ? 'light-dark(black, white)'
65 : 'white'
66 }>
67 <circle cx="12" cy="12" r="10" strokeWidth="4" fill="none" className="opacity-25" />
68 <circle
69 cx="12"
70 cy="12"
71 r="10"
72 strokeWidth="4"
73 strokeLinecap="round"
74 fill="none"
75 pathLength="100"
76 strokeDasharray="60 140"
77 strokeDashoffset="0"
78 />
79 </svg>
80 </span>
81 )}
82 </>
83 ))}
84 </RACButton>
85 );
86}

Callers

nothing calls this directly

Calls 1

composeRenderPropsFunction · 0.85

Tested by

no test coverage detected