Function
Button
({
children,
variant,
color,
size = 'md',
rounded = false,
isLoading = false,
disabled,
className,
...props
}: Props<V>)
Source from the content-addressed store, hash-verified
| 92 | ); |
| 93 | |
| 94 | export function Button<V extends ButtonVariant>({ |
| 95 | children, |
| 96 | variant, |
| 97 | color, |
| 98 | size = 'md', |
| 99 | rounded = false, |
| 100 | isLoading = false, |
| 101 | disabled, |
| 102 | className, |
| 103 | ...props |
| 104 | }: Props<V>) { |
| 105 | const isDisabled = isLoading || disabled; |
| 106 | |
| 107 | return ( |
| 108 | <button |
| 109 | type="button" |
| 110 | className={cn( |
| 111 | ButtonVariants({ variant, color, size }), |
| 112 | isDisabled && `cursor-not-allowed bg-gray-100 text-gray-400 hover:bg-gray-100`, |
| 113 | rounded ? 'rounded-full' : 'rounded-[10px] md:rounded-xl', |
| 114 | className |
| 115 | )} |
| 116 | disabled={isDisabled} |
| 117 | {...props} |
| 118 | > |
| 119 | {isLoading && ( |
| 120 | <Icon name="loading" size={25} className="mr-1.5 -ml-1 animate-spin max-md:h-[20px]" /> |
| 121 | )} |
| 122 | {children} |
| 123 | </button> |
| 124 | ); |
| 125 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected