Skip to main content

Navigation

Flash Saved code

Copy the implementation or inspect every file that belongs to this component unit.

resources/views/components/ui/flash-saved.blade.php

@props([
    'show' => false,
    'message' => 'Saved.',
    'duration' => 2000,
])

@php
    /*
    | Inline saved confirmation that auto-hides after a short delay.
    |
    | Usage:
    |   <x-ui.flash-saved :show="session('status') === 'profile-updated'" />
    */
@endphp

@if ($show)
    <p
        x-data="{ show: true }"
        x-show="show"
        x-transition
        x-init="setTimeout(() => show = false, {{ $duration }})"
        {{ $attributes->merge(['class' => 'flex items-center gap-1.5 text-sm text-green-600 dark:text-green-400']) }}
    >
        <x-ui.icon name="check-circle" weight="fill" size="sm" />
        {{ $message }}
    </p>
@endif