A wider screen, please

This page features interactive demos and side-by-side code samples that need at least 340 pixels of horizontal space. Please widen your browser window, or rotate your device, to continue.

Morpheus v0.3.0
v0.3.0

If network#

Component <neo-if-network> is a connection gate. It shows its content only while the browser is online (online) or offline (online="false"), and switches when the connection changes. To require a platform too, nest it in <neo-if-platform> .

Reference#

Attributes #

NameTypeDefaultDescription
onlineboolean observedunsetThe connection state to show in. online shows while online, online="false" while offline, and unset in both. Offline is reliable; online only means the device is on a network, not that the server is reachable.
delaynumber0Milliseconds a connection change must last before the content switches. A shorter drop shows nothing. The state on page load applies at once.

Slots #

NameDescription
defaultShown only in the connection state online selects.

Examples#

Connection status#

One branch per connection state tells the user whether their changes reach the server.

  • Because the role="status" wrapper stays on the page, screen readers announce the branch that appears. A live region must be on the page before its content changes.
  • online only means the device is on a network. A server that is down still counts as online.
  • delay="2000" switches only after the connection has changed for 2 seconds. A shorter drop shows nothing.
  • In DevTools, set Network throttling to Offline and wait 2 seconds to see the other branch.

Connected. Your changes save as you type.

You're offline. Your changes save when the connection returns.

Settings

Theme

DefaultSunshineOceanMatrixRose☀ ◐ ☾

Accessibility

Playgrounds

Server Simulator