Hi, depends on how you will use it, but, you could do something like this
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 3000)">
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
I think it's all in the title :D. I can't find a way to hide a flash message after 3 seconds with Alpine. What I have so far:
<div x-data="{ show: true }" x-show="show">
<div>
{{ session('status') }}
</div>
</div>
<script>
setTimeout(() => show = false, 3000);
</script>
Any idea? Thanks
Hi, depends on how you will use it, but, you could do something like this
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 3000)">
Please or to participate in this conversation.