Skip to content
GaudiGaudi Design System home

Search documentation

Search every page, heading and paragraph.

useReadLocalStorage

Read-only localStorage subscriptions shared with useLocalStorage.

HooksData@gaudi/design-system/hooks/data/use-read-local-storageView in StorybookSource

Reads through the same store as useLocalStorage, including same-tab notifications, native cross-tab storage events and blocked-storage fallback. It never exposes write actions.

Usage

import { useReadLocalStorage } from '@gaudi/design-system/hooks';
const density = useReadLocalStorage('reading-density', 'comfortable');

Examples

Playground

Storybook

API

4 options
1 return value

Accessibility

Announce meaningful changes in context. Do not put sensitive data in browser storage.

Notes

  • Same-tab changes made with useLocalStorage notify readers. Direct localStorage.setItem calls in the same tab do not dispatch a storage event.