{{-- M3 Expressive's top app bar: the title of the screen, a navigation button and its actions. `variant`: `small` (the default, 64px), `center` (the title centred), `medium` and `large` (a big title under the row that collapses into the small one as the page scrolls), and `search` (a search bar fills the row: put an `` in the slot). `title` and `subtitle`; the title is an `

` unless `heading` names another element. Slots: `navigation` (the leading icon button: back, or the menu) and `actions` (trailing icon buttons, an avatar). Sticky at the top by default (`:sticky="false"` for one that scrolls away), under the top safe area; the surface turns surface-container once content scrolls under it (resources/css/components/app-bar.css, resources/js/app-bar.js). A collapsing bar needs the window to be what scrolls: an ancestor with `overflow: hidden` or `auto` would stop it sticking (`overflow-x: clip` is fine). --}} @props([ 'title' => null, 'subtitle' => null, 'variant' => 'small', 'sticky' => true, 'heading' => 'h1', ]) @php $variant = in_array($variant, ['small', 'center', 'medium', 'large', 'search'], true) ? $variant : 'small'; $flexible = in_array($variant, ['medium', 'large'], true); $heading = in_array($heading, ['h1', 'h2', 'h3', 'div', 'p'], true) ? $heading : 'h1'; @endphp
@isset($navigation)
{{ $navigation }}
@endisset @if ($variant === 'search')
{{ $slot }}
@elseif (filled($title)) @endif @isset($actions)
{{ $actions }}
@endisset
@if ($flexible && filled($title))
<{{ $heading }} data-app-bar-title>{{ $title }} @if (filled($subtitle))

{{ $subtitle }}

@endif
@endif @if ($variant !== 'search' && $slot->hasActualContent()) {{ $slot }} @endif