Skip to content
GaudiGaudi Design System home

Search documentation

Search every page, heading and paragraph.

useOnlineStatus

Whether the browser reports a network connection.

HooksEnvironment@gaudi/design-system/hooks/environment/use-online-statusView in StorybookSource

Follows the online and offline events. False is reliable: queue work and say so. True only means 'maybe' (a captive portal reports online), so request errors stay the source of truth.

Usage

import { useOnlineStatus } from '@gaudi/design-system/hooks';
const online = useOnlineStatus();<Button disabled={!online}>Publish</Button>

Examples

Offline notice

Storybook

API

1 return value

Accessibility

Show offline state as text (an Alert or a status region), not only as a colour, and keep entered work.

Notes

  • Do not block reading content offline; disable only the actions that need the network.