@props([
'variant' => 'primary',
'size' => 'md',
'icon' => null,
'iconPosition' => 'left',
'loading' => false,
'disabled' => false,
'href' => null,
'type' => 'button',
])
@php
$classes = 'btn';
// Variant classes
$classes .= match($variant) {
'primary' => ' btn-primary',
'secondary' => ' btn-secondary',
'outline' => ' btn-outline',
'ghost' => ' btn-ghost',
'danger' => ' btn-danger',
default => ' btn-primary',
};
// Size classes
$classes .= match($size) {
'sm' => ' btn-sm',
'lg' => ' btn-lg',
'icon' => ' btn-icon',
default => '',
};
// Additional classes
$classes .= ' ' . ($attributes->get('class') ?? '');
$isDisabled = $disabled || $loading;
@endphp
@if($href && !$isDisabled)
merge(['class' => $classes]) }}>
@if($loading)
@else
@if($icon && $iconPosition === 'left')
@endif
{{ $slot }}
@if($icon && $iconPosition === 'right')
@endif
@endif
@else
@endif