@props([ 'percent' => 0, 'color' => 'indigo', 'size' => 'md', 'showLabel' => false, ]) @php $percent = min(100, max(0, $percent)); $colors = [ 'indigo' => 'bg-indigo-600 dark:bg-indigo-500', 'green' => 'bg-green-600 dark:bg-green-500', 'red' => 'bg-red-600 dark:bg-red-500', 'blue' => 'bg-blue-600 dark:bg-blue-500', 'yellow' => 'bg-yellow-500 dark:bg-yellow-400', 'purple' => 'bg-purple-600 dark:bg-purple-500', ]; $sizes = [ 'sm' => 'h-1.5', 'md' => 'h-2.5', 'lg' => 'h-4', ]; // Auto color based on percentage for budget tracking if ($color === 'auto') { $color = match(true) { $percent >= 100 => 'red', $percent >= 80 => 'yellow', default => 'green', }; } @endphp
merge(['class' => 'w-full']) }}> @if($showLabel)
{{ $slot }} {{ number_format($percent, 0) }}%
@endif