{{-- One destination in an ``, drawn in whichever shape the rail has. Expanded, it is a 56px full-width pill: the icon, the label-large label beside it and a count at its end. Collapsed, the icon sits in a 56×32 indicator over a label-medium label (two lines at most), with the count on the icon. The current destination (`active`) is `aria-current="page"` with the filled icon on secondary-container, its label in secondary when collapsed. `link` renders an anchor with `wire:navigate` (unless `external` or `no-wire-navigate`); without one it is a button. `badge`: `true` for M3's small dot on the icon, a number or a few characters for the large badge (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 NavigationRailVerticalItemTokens.kt, NavigationRailHorizontalItemTokens.kt, NavigationRailBaselineItemTokens.kt and NavigationRailColorTokens.kt (androidx Compose Material 3, Apache-2.0); see ``. Compose's expanded item hugs its label; the package draws the full-width pill, which leaves room for the count at the end. --}} @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([ 'href' => $isLink ? $link : null, 'target' => $isLink && $external ? '_blank' : null, 'rel' => $isLink && $external ? 'noopener' : null, 'wire:navigate' => $isLink && ! $external && ! $noWireNavigate && ! $attributes->has('wire:navigate') ? true : null, '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-rail-item {{ $attributes }}> @if ($icon) @endif @if ($dot) @elseif ($count) @endif {{ $label ?? $slot }} @if ($count) @endif @if ($spoken !== null) , {{ $spoken }} @endif