Docs Hub

🇮🇷
iran mirrors
LaravelLaravelLivewireLivewireAlpine.jsAlpine.jsNext.jsNext.jsVue.jsVue.jsZustandZustandNuxt.jsNuxt.jsFilamentFilament
BootstrapBootstrap
Nest.jsNest.js
ReactReact
Vite.jsVite.js
Tailwind CSSTailwind CSS

© 2026 Juza66 and Arash Fadaee

Docs Hub

🇮🇷 iran mirrorsActionsAGENTSAlpineAttribute AsyncAttribute ComputedAttribute DeferAttribute IsolateAttribute JsAttribute JsonAttribute LayoutAttribute LazyAttribute LockedAttribute ModelableAttribute OnAttribute ReactiveAttribute RenderlessAttribute SessionAttribute TitleAttribute TransitionAttribute UrlAttribute ValidateBest PracticesBlade ComponentsBundlingComponent HooksComponentsComputed PropertiesContribution GuideCspDirective IslandDirective PersistDirective PlaceholderDirective TeleportDirtyDownloadsEventsFormsHow Livewire WorksHydrationInstallationIslandsJavascriptLazyLifecycle HooksLoading StatesLockedMorphNavigateNestingOfflinePackagesPagesPaginationPollingPropertiesQuickstartRedirectingSecuritySession PropertiesStylesSynthesizersTeleportTestingThe Livewire ProtocolTroubleshootingUnderstanding NestingUndocumented Features TodoUpgrade Guide Scratch FileUpgradingUploadsUrlValidationVoltWire BindWire ClickWire CloakWire ConfirmWire CurrentWire DirtyWire IgnoreWire InitWire IntersectWire LoadingWire ModelWire NavigateWire OfflineWire PollWire RefWire ReplaceWire ShowWire SortWire StreamWire SubmitWire TextWire Transition
Docs Hub

In real-time applications, it can be helpful to provide a visual indication that the user's device is no longer connected to the internet.

For example, if you have built a blogging platform on Livewire, you may want to notify your users if they are offline so that they don't draft an entire blog post without the ability for Livewire to save it to the database.

Livewire provides the wire:offline directive for such cases. By adding wire:offline to an element inside a Livewire component, it will be hidden by default and become visible when the user loses connection:

blade
<div wire:offline>
    This device is currently offline.
</div>

The element will disappear again when the network connection is restored.

Toggling classes

Adding the class modifier allows you to add a class to an element when the user loses their connection. The class will be removed again, once the user is back online:

blade
<div wire:offline.class="bg-red-300">

Or, using the .remove modifier, you can remove a class when a user loses their connection. In this example, the bg-green-300 class will be removed from the <div> while the user has lost their connection:

blade
<div class="bg-green-300" wire:offline.class.remove="bg-green-300">

Toggling attributes

The .attr modifier allows you to add an attribute to an element when the user loses their connection. In this example, the "Save" button will be disabled while the user has lost their connection:

blade
<button wire:offline.attr="disabled">Save</button>

Reference

blade
wire:offline

Modifiers

ModifierDescription
.class="class-name"Add a CSS class when offline
.class.remove="class-name"Remove a CSS class when offline
.attr="attribute"Add an HTML attribute when offline