generated from boboko/starter
34 lines
1.2 KiB
PHP
34 lines
1.2 KiB
PHP
@aware(['id'])
|
|||
|
|
|
||
|
|
@props([
|
||
|
|
'href' => null,
|
||
|
|
'current' => false,
|
||
|
|
'close' => true,
|
||
|
|
])
|
||
|
|
|
||
|
|
{{--
|
||
|
|
A single option inside <x-ui.dropdown>.
|
||
|
|
|
||
|
|
- Renders a <button> by default, or an <a> when :href is given.
|
||
|
|
- `close` (button only): also dismiss the panel on click via
|
||
|
|
popovertargetaction="hide". Any data-action on the same button still
|
||
|
|
fires — Stimulus handler runs AND the popover closes. Pass :close="false"
|
||
|
|
for options that shouldn't close the panel (e.g. a multi-select filter).
|
||
|
|
- `current`: marks the active option (aria-current + bold).
|
||
|
|
- Everything else (data-action, data-*-param, aria-*, class, …) is forwarded.
|
||
|
|
|
||
|
|
`id` comes from the parent <x-ui.dropdown> via @aware.
|
||
|
|
--}}
|
||
|
|
|
||
|
|
@php $tag = $href ? 'a' : 'button'; @endphp
|
||
|
|
|
||
|
|
<{{ $tag }}
|
||
|
|
@if($tag === 'button') type="button" @endif
|
||
|
|
@if($href) href="{{ $href }}" @endif
|
||
|
|
@if($close && $tag === 'button') popovertarget="{{ $id }}" popovertargetaction="hide" @endif
|
||
|
|
@if($current) aria-current="true" @endif
|
||
|
|
{{ $attributes->merge(['class' => 'block w-full text-left px-5 py-2.5 cursor-pointer transition-colors hover:bg-black hover:text-neutral-200 aria-[current=true]:font-bold']) }}
|
||
|
|
>
|
||
|
|
{{ $slot }}
|
||
|
|
</{{ $tag }}>
|