@props([ 'type' => 'button', 'external' => false, 'link' => null, 'label' => null, 'icon' => null, 'spinner' => null, 'tooltip' => null, 'tooltipLeft' => null, 'tooltipRight' => null, 'tooltipBottom' => null, 'badge' => null, 'badgeClasses' => null, ]) @php $tooltip = $tooltip ?? $tooltipLeft ?? $tooltipRight ?? $tooltipBottom; $tooltipPosition = $tooltipLeft ? 'lg:tooltip-left' : ($tooltipRight ? 'lg:tooltip-right' : ($tooltipBottom ? 'lg:tooltip-bottom' : 'lg:tooltip-top')); $spinnerTarget = $spinner ?? $attributes->whereStartsWith('wire:click')->first(); @endphp @if($link) whereDoesntStartWith('class')->merge(['type' => $type]) }} {{ $attributes->class(['btn', "!inline-flex lg:tooltip $tooltipPosition" => $tooltip]) }} @if($link && $external) target="_blank" @endif @if($link && !$external) wire:navigate @endif data-tip="{{ $tooltip }}" @if($spinner) wire:target="{{ $spinnerTarget }}" wire:loading.attr="disabled" @endif > {{-- spinner --}} @if($spinner) Loading @endif {{-- icon --}} @if($icon) @endif {{-- label / slot --}} @if($label) {{ $label }} @if(strlen($badge ?? '') > 0) {{ $badge }} @endif @else {{ $slot }} @endif @if($link) @else @endif