Skip to content
GaudiGaudi Design System home

Search documentation

Search every page, heading and paragraph.

useTimeout

A one-off timer with reset and clear.

HooksState@gaudi/design-system/hooks/state/use-timeoutView in StorybookSource

Calls the callback once, delay ms after mount or after the delay changes. Pass null to hold it; reset restarts it and clear cancels it.

Usage

import { useTimeout } from '@gaudi/design-system/hooks';
const { clear, reset } = useTimeout(() => setVisible(false), visible ? 5000 : null);

Examples

Auto-dismiss that pauses

Storybook

API

2 options
1 return value

Accessibility

Auto-dismissed messages must stay long enough to read, pause while hovered or focused, and stay available elsewhere (WCAG 2.2.1).

Notes

  • Clear on hover and focus, reset on leave and blur, for dismissible notices.