Replies: 3 comments 5 replies
-
@jeffchown nice! Thanks for sharing. You could also create a
<div x-on:click="visible = false" class="contents">
{{ $slot }}
</div> <x-dismissable>
<flux:callout icon="bell" variant="secondary" inline>
<flux:callout.heading class="flex gap-2 @max-md:flex-col items-start">Upcoming meeting <flux:text>10:00 AM</flux:text></flux:callout.heading>
<x-slot name="controls">
<x-dismissable.trigger>
<flux:button icon="x-mark" variant="ghost" />
</x-dismissable.trigger>
</x-slot>
</flux:callout>
</x-dismissable> |
Beta Was this translation helpful? Give feedback.
-
@jeffchown I just made a showcase discussion category for stuff like this too and moved this into it 😁 |
Beta Was this translation helpful? Give feedback.
-
Combining @calebporzio's X post and @joshhanley's great suggestion, here's my revised
<div x-data="{ visible: true }" x-show="visible" x-collapse>
<div x-show="visible" x-transition>
{{ $slot }}
</div>
</div>
<div x-on:click="visible = false" class="contents">
{{ $slot }}
</div> Usage: (w/ <x-dismissable>
<flux:callout icon="bell" variant="secondary" inline>
<flux:callout.heading class="flex gap-2 @max-md:flex-col items-start">
Upcoming meeting <flux:text>10:00 AM</flux:text>
</flux:callout.heading>
<x-slot name="controls">
<x-dismissable.trigger>
<flux:button icon="x-mark" variant="ghost" />
</x-dismissable.trigger>
</x-slot>
</flux:callout>
</x-dismissable> |
Beta Was this translation helpful? Give feedback.
-
Morning, all,
Here's a handy little component that uses @calebporzio's great tip on X this morning (https://x.com/calebporzio/status/1899472846516003056) re: making a callout dismissable:
resources/views/components/dismissable.blade.php
You can use it like this:
You can actually wrap anything in
x-dismissable
as long as your$slot
content somewhere contains a tag that hasx-on:click="visible = false"
on it. (and you don't have any conflicting Alpine code in your$slot
content or in any of the parent tags)Beta Was this translation helpful? Give feedback.
All reactions