{{-- One destination in an ``. `link` renders an anchor with `wire:navigate` (unless `external` or `no-wire-navigate`); without one it is a button, for a destination a Livewire action switches to. `active` marks the current destination: `aria-current="page"`, the filled icon in on-secondary-container on the secondary-container indicator, and the label in secondary (on-secondary-container inside the medium bar's pill). `badge` puts M3's badge on the icon: `true` for the small dot, a number or a few characters for the large one (999+ at most). Screen readers hear a count after the label (", 12"); `badge-label` replaces it with words ("12 unread") and gives a dot something to say. Values from NavigationBarTokens.kt and NavigationBarVerticalItemTokens.kt (androidx Compose Material 3, Apache-2.0); see ``. --}} @props([ 'label' => null, 'icon' => null, 'link' => null, 'external' => false, 'noWireNavigate' => false, 'active' => false, 'badge' => null, 'badgeLabel' => null, ]) @php $isLink = filled($link); $tag = $isLink ? 'a' : 'button'; $dot = $badge === true; $count = ! $dot && $badge !== null && $badge !== false && $badge !== ''; $spoken = $badgeLabel ?? ($count ? $badge : null); $attributes = $attributes->merge(array_filter([ ...\NoNameWeb\LivewireMaterial\Support\Link::attributes($isLink, $link, $external, $attributes, $noWireNavigate), 'type' => $isLink ? null : 'button', 'aria-current' => $active ? 'page' : null, 'data-md-active' => $active ? true : null, ], fn ($value): bool => $value !== null)); @endphp <{{ $tag }} data-md-navigation-bar-item {{ $attributes }}> @if ($icon) @endif @if ($dot) @elseif ($count) @endif {{ $label ?? $slot }} @if ($spoken !== null) , {{ $spoken }} @endif