Utility Hooks
General utility and helper hooks
General-purpose utility hooks.
From @tetherto/mdk-react-adapter
useBeepSound
Plays a repeating beep sound at a configurable interval.
({ isAllowed = DEFAULTS.IS_ALLOWED, volume = DEFAULTS.VOLUME, delayMs = DEFAULTS.DELAY_MS, }: UseBeepSoundOptions = {}) => voiduseContextualModal
Headless open/close state for a modal that needs to remember the subject it was opened against (the row being edited, the device being inspected, etc.).
({ onOpen, onClose, }: UseContextualModalParams = {}) => { modalOpen: boolean; handleClose: () => void; handleOpen: (sub: T | null) => void; subject: T | null; setSubject: React.Dispatch<React.SetSta…useDeviceResolution
Hook to detect current device resolution/viewport size
() => DeviceResolutionuseKeyDown
Tracks whether a specific keyboard key is currently held down.
(keyName: string) => booleanuseLocalStorage
Custom hook for type-safe localStorage access with cross-tab sync.
(key: string, defaultValue: T) => [T, (value: T | ((prev: T) => T)) => void, VoidFunction]usePagination
Custom hook for managing pagination state
(args: PaginationArgs = {}) => UsePaginationReturnusePlatform
SSR-safe React hook returning the detected client OS.
() => PlatformResultuseSubtractedTime
Returns Date.now() - diff, refreshing on a fixed interval (default 5s).
(diff: number, interval = DEFAULT_INTERVAL) => numberuseTimezoneFormatter
Timezone-aware date formatting hook.
() => UseTimezoneFormatterReturnuseWindowSize
Hook to track window size changes
() => WindowSizeFrom @tetherto/mdk-react-devkit
useCostSummary
Base hook for the cost-summary reporting page (single-site mode).
({ query, ...dateRangeOptions }?: UseCostSummaryOptions) => { queryParams: CostSummaryQueryParams | null; isLoading: boolean; error: {} | null; metrics: CostSummaryDisplayMetrics | null; costLog: readonly CostTimeSeriesEntry[]; btcPriceLog:… /* see source */