{{-- An M3 rich tooltip: a few lines of context for a control, with an optional subhead and actions. It wraps its trigger. By default it shows on hover and keyboard focus like a plain tooltip; `persistent` makes it open on press instead and stay until a press elsewhere or Escape — the form M3 asks for when it has actions. The bubble is a popover in surface-container with a medium corner and elevation 2, 312px at most, placed by anchor positioning on `side`. RichTooltipTokens (androidx Compose Material 3, Apache-2.0): title-small subhead and body-medium text in on-surface-variant, label-large actions in primary. --}} @props([ 'title' => null, 'text' => null, 'side' => 'bottom', 'persistent' => false, ]) @php $side = in_array($side, ['top', 'bottom', 'left', 'right'], true) ? $side : 'bottom'; $key = \Illuminate\Support\Str::lower(\Illuminate\Support\Str::random(10)); $anchor = "--material-rich-tooltip-{$key}"; @endphp class('inline-flex') }} style="anchor-name: {{ $anchor }}" x-data="materialRichTooltip({{ $persistent ? 'true' : 'false' }})" > {{ $trigger ?? $slot }} $side === 'bottom', 'my-1 [position-area:top_span-right] [position-try-fallbacks:flip-block,flip-inline]' => $side === 'top', 'mx-1 [position-area:left_span-bottom] [position-try-fallbacks:flip-inline,flip-block]' => $side === 'left', 'mx-1 [position-area:right_span-bottom] [position-try-fallbacks:flip-inline,flip-block]' => $side === 'right', ]) > @if ($title) {{ $title }} @endif {{ $text }} @isset($actions) {{ $actions }} @endisset