@props([ 'type' => 'button', 'variant' => 'primary', 'size' => 'md', 'icon' => null, 'iconPosition' => 'left', 'iconClass' => null, 'loading' => false, 'disabled' => false, 'fullWidth' => false, 'href' => null, 'outline' => false, 'rounded' => 'lg', ]) @php // Base classes $baseClasses = 'inline-flex items-center justify-center font-semibold transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed'; // Size classes $sizeClasses = match($size) { 'xs' => 'px-2 py-1 text-xs gap-1', 'sm' => 'px-3 py-1.5 text-sm gap-1.5', 'md' => 'px-4 py-2 text-sm gap-2', 'lg' => 'px-5 py-2.5 text-base gap-2', 'xl' => 'px-6 py-3 text-base gap-2.5', default => 'px-4 py-2 text-sm gap-2', }; // Icon size classes $iconSizeClasses = $iconClass ?? match($size) { 'xs' => 'size-3', 'sm' => 'size-3.5', 'md' => 'size-4', 'lg' => 'size-5', 'xl' => 'size-5', default => 'size-4', }; // Variant classes $variantClasses = match($variant) { 'primary' => $outline ? 'border-2 border-primary text-primary hover:bg-primary hover:text-white focus:ring-primary/50' : 'bg-primary text-white hover:bg-primary/90 focus:ring-primary/50', 'secondary' => $outline ? 'border-2 border-secondary text-secondary hover:bg-secondary hover:text-white focus:ring-secondary/50' : 'bg-secondary text-white hover:bg-secondary/90 focus:ring-secondary/50', 'success' => $outline ? 'border-2 border-success text-success hover:bg-success hover:text-white focus:ring-success/50' : 'bg-success text-white hover:bg-success/90 focus:ring-success/50', 'danger' => $outline ? 'border-2 border-danger text-danger hover:bg-danger hover:text-white focus:ring-danger/50' : 'bg-danger text-white hover:bg-danger/90 focus:ring-danger/50', 'warning' => $outline ? 'border-2 border-warning text-warning hover:bg-warning hover:text-white focus:ring-warning/50' : 'bg-warning text-white hover:bg-warning/90 focus:ring-warning/50', 'info' => $outline ? 'border-2 border-info text-info hover:bg-info hover:text-white focus:ring-info/50' : 'bg-info text-white hover:bg-info/90 focus:ring-info/50', 'ghost' => 'text-base/70 hover:text-base/90 hover:bg-neutral/10 focus:ring-neutral/50', 'link' => 'text-primary hover:text-primary/80 underline-offset-4 hover:underline focus:ring-primary/50 p-0', 'neutral' => $outline ? 'border border-neutral/30 text-base/70 hover:bg-neutral/10 hover:text-base/90 focus:ring-neutral/50' : 'bg-neutral/10 text-base/80 hover:bg-neutral/20 focus:ring-neutral/50', default => $outline ? 'border-2 border-primary text-primary hover:bg-primary hover:text-white focus:ring-primary/50' : 'bg-primary text-white hover:bg-primary/90 focus:ring-primary/50', }; // Rounded classes $roundedClasses = match($rounded) { 'none' => 'rounded-none', 'sm' => 'rounded-sm', 'md' => 'rounded-md', 'lg' => 'rounded-lg', 'xl' => 'rounded-xl', 'full' => 'rounded-full', default => 'rounded-lg', }; // Full width $widthClasses = $fullWidth ? 'w-full' : ''; // Combined classes $classes = "$baseClasses $sizeClasses $variantClasses $roundedClasses $widthClasses"; // Determine tag $tag = $href ? 'a' : 'button'; @endphp @if($href) merge(['class' => $classes]) }}> @else @endif