Skip to content
UI Brok

Loading…

No results

Browse catalog

Livewire Toast

A server-driven toast listener that subscribes to a Livewire browser event and shows a transient, auto-dismissing notification on dispatch. Requires Livewire 3.

Preview

Dispatch $this->dispatch('notify', message: 'Saved', variant: 'success') from a Livewire action to raise a toast in the corner.

Controls

Theme
Surface
Direction
Viewport

Device view renders in an isolated frame so real responsive breakpoints apply. Switch to Full for overflowing popovers.

Installation

terminal
php artisan ui:add livewire-toast

Registry contract

Install confidence

php artisan ui:add livewire-toast writes only the generated targets below. The CLI validates each file hash before writing and prompts before replacing local changes unless --force is used.

Version
1.0.0
License
open
Stability
stable
Contract
v2
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/components/ui/livewire-toast.blade.php

Registry dependencies

None.

Package dependencies

composer: jml/brok:^1.0

Guidance

Livewire framework adapter

Add server-driven behavior to an existing interaction pattern.

Use when

  • Use this Livewire variant when the same core pattern needs server-driven interactivity. Apply the underlying base component’s usability rules; the framework integration does not change when the pattern is appropriate.

Avoid when

  • Apply the toast guidance: reserve for low-priority transient feedback, even when emitted from the server.
Task length
short
Interaction cost
medium
Interruptiveness
none
Input precision
none
Mobile / touch risk
medium
Accessibility risk
high
Needs background context
Yes
Comparison needed
No

Preferred alternatives

  • Base component without server round trips

Anti-patterns

  • Treating framework integration as a UX rationale

API

manifest knowledge + registry-derived coverage

Props

Prop Type / values Default Description
event string notify Declared by @props in the registry Blade source.
position string bottom-right Declared by @props in the registry Blade source.
duration int 4000 Declared by @props in the registry Blade source.

Slots

Components use the default Blade slot unless a documented subcomponent is installed by the registry item.

Data slots

livewire-toast livewire-toast-item

Capabilities

wcag-2.2-aa-target responsive rtl darkMode localized livewire-3

Behavior

  • Uses server-rendered Blade and semantic HTML.
  • Declares registry capability flags: a11y, responsive, rtl, darkMode, localized, requires.

Usage

previews.components.livewire-toast.default.blade.php Blade
{{-- The toast renders into a fixed corner region. In a Livewire app it appears
     when the server dispatches the `notify` event; here we show a static demo
     item plus the live listener so the placement is visible. --}}
<div class="relative min-h-32 w-full max-w-md">
    <x-ui.livewire-toast event="notify" position="bottom-right" />

    <div class="rounded-lg border border-border bg-card p-4 text-sm text-muted-foreground">
        {{ __('Dispatch') }}
        <code class="rounded bg-muted px-1.5 py-0.5 font-mono text-foreground">$this-&gt;dispatch('notify', message: 'Saved', variant: 'success')</code>
        {{ __('from a Livewire action to raise a toast in the corner.') }}
    </div>
</div>

Accessibility & localization

WCAG 2.2 AA RTL-ready data-slot Keyboard focus-visible Localized labels
  • Accessibility target: wcag-2.2-aa-target.
  • Uses semantic HTML and a stable data-slot attribute for styling/scripting hooks.
  • Focus-visible rings use the ring token so keyboard focus is always visible.
  • Disabled and invalid states are conveyed to assistive tech, not by color alone.
  • Targets WCAG 2.2 AA; verify contrast in light, dark, admin and customer surfaces above.
  • Labels go through __() and the component uses logical properties (ms-*, text-start, start-*) so it mirrors correctly — flip the preview to RTL to confirm.

Source

The exact, editable file ui:add writes into your app — copy it or own the whole thing. Previews render this same code; there are no preview-only components.

Changelog

Current version: v1.0.0. See the site changelog for the full release history.