{{--
Badge Component - LucentUI Theme
Migrated from AdminLTE to Tailwind
Usage:
Default
Running
Error
Active
--}}
@props([
'variant' => 'default',
'size' => 'md',
'icon' => null,
'dot' => false,
'pulse' => false,
])
@php
$variantClasses = [
'default' => 'bg-primary/20 text-primary',
'primary' => 'bg-primary/20 text-primary',
'secondary' => 'bg-neutral/20 text-base/70',
'success' => 'bg-success/20 text-success',
'warning' => 'bg-warning/20 text-warning',
'danger' => 'bg-error/20 text-error',
'info' => 'bg-info/20 text-info',
'light' => 'bg-neutral/10 text-base/60',
'dark' => 'bg-neutral/80 text-white',
'muted' => 'bg-neutral/20 text-base/50',
];
$sizeClasses = [
'xs' => 'px-1.5 py-0.5 text-[10px]',
'sm' => 'px-2 py-0.5 text-xs',
'md' => 'px-2.5 py-1 text-xs',
'lg' => 'px-3 py-1.5 text-sm',
];
$iconSizes = [
'xs' => 'size-2.5',
'sm' => 'size-3',
'md' => 'size-3.5',
'lg' => 'size-4',
];
$dotSizes = [
'xs' => 'size-1',
'sm' => 'size-1.5',
'md' => 'size-1.5',
'lg' => 'size-2',
];
$iconSize = $iconSizes[$size] ?? $iconSizes['md'];
$dotSize = $dotSizes[$size] ?? $dotSizes['md'];
$badgeSize = $sizeClasses[$size] ?? $sizeClasses['md'];
@endphp
class([
'inline-flex items-center font-semibold rounded-full transition-all duration-200',
$badgeSize,
$variantClasses[$variant] ?? $variantClasses['default'],
'gap-1.5' => $icon || $dot,
]) }}>
@if($dot)
@if($pulse)
@endif
@endif
@if($icon)
@endif
{{ $slot }}