@props([ 'label' => '', 'value' => '—', 'icon' => null, 'tone' => 'neutral', 'help' => null, 'trend' => null, // ['direction' => 'up|down|flat', 'value' => '+2.4%'] 'kind' => 'count', // money | count | score 'href' => null, 'loading' => false, ]) @php $toneClass = 'stat--tone-' . ($tone ?: 'neutral'); $classes = trim('stat ' . $toneClass . ($loading ? ' stat--loading' : '')); $Tag = $href ? 'a' : 'div'; @endphp <{{ $Tag }} @if($href) href="{{ $href }}" @endif {{ $attributes->merge(['class' => $classes]) }} @if($help) title="{{ $help }}" @endif >
@if($icon) {!! icon($icon) !!} @endif {{ $label }}
@if($loading) @else {{ $value }} @endif
@if($trend)
{!! icon('arrow-' . ($trend['direction'] === 'down' ? 'down' : ($trend['direction'] === 'up' ? 'up' : 'right')), 'stat__trend-icon') !!} {{ $trend['value'] ?? '' }} @isset($trend['label']){{ $trend['label'] }}@endisset
@endif @if($help && ! $attributes->get('title'))

{{ $help }}

@endif