{{-- Button Component - TailAdmin Theme Usage: Click me Add Server Delete Processing --}} @props([ 'variant' => 'secondary', 'size' => 'md', 'icon' => null, 'iconRight' => null, 'loading' => false, 'loadingText' => null, 'disabled' => false, 'href' => null, 'type' => 'button', 'full' => false, ]) @php $tag = $href ? 'a' : 'button'; $baseClasses = 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg font-medium transition-colors focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-brand-500/10 disabled:pointer-events-none disabled:opacity-50'; $variantClasses = [ 'primary' => 'bg-brand-500 text-white shadow-theme-xs hover:bg-brand-600', 'secondary' => 'bg-white text-gray-700 shadow-theme-xs ring-1 ring-gray-300 hover:bg-gray-50 dark:bg-gray-800 dark:text-gray-400 dark:ring-gray-700 dark:hover:bg-white/[0.03]', 'outline' => 'border border-gray-300 bg-white shadow-theme-xs hover:bg-gray-50 hover:text-gray-800 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-white/[0.03] dark:hover:text-gray-200', 'ghost' => 'hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-white/5 dark:hover:text-gray-300', 'danger' => 'bg-error-500 text-white shadow-theme-xs hover:bg-error-600', 'success' => 'bg-success-500 text-white shadow-theme-xs hover:bg-success-600', 'warning' => 'bg-warning-500 text-white shadow-theme-xs hover:bg-warning-600', 'info' => 'bg-blue-light-500 text-white shadow-theme-xs hover:bg-blue-light-600', 'link' => 'text-brand-500 hover:text-brand-600 hover:underline underline-offset-4', ]; $sizeClasses = [ 'xs' => 'h-8 px-2.5 text-xs', 'sm' => 'h-9 px-3 text-sm', 'md' => 'h-10 px-4 text-sm', 'lg' => 'h-11 px-5 text-sm', 'xl' => 'h-12 px-6 text-base', 'icon' => 'h-10 w-10', ]; $iconSizes = [ 'xs' => 'size-3.5', 'sm' => 'size-4', 'md' => 'size-4', 'lg' => 'size-5', 'xl' => 'size-5', 'icon' => 'size-5', ]; $classes = collect([ $baseClasses, $variantClasses[$variant] ?? $variantClasses['secondary'], $sizeClasses[$size] ?? $sizeClasses['md'], $full ? 'w-full' : '', ])->filter()->join(' '); $iconSize = $iconSizes[$size] ?? $iconSizes['md']; @endphp <{{ $tag }} @if($href) href="{{ $href }}" @endif @if($tag === 'button') type="{{ $type }}" @endif @if($disabled || $loading) disabled @endif {{ $attributes->class([$classes]) }} > @if($loading) {{ $loadingText ?? $slot }} @else @if($icon) @endif {{ $slot }} @if($iconRight) @endif @endif