UNPKG

@supunlakmal/hooks

Version:

A collection of reusable React hooks

18 lines (17 loc) 877 B
declare const defaultBreakpoints: { readonly sm: "(min-width: 640px)"; readonly md: "(min-width: 768px)"; readonly lg: "(min-width: 1024px)"; readonly xl: "(min-width: 1280px)"; readonly '2xl': "(min-width: 1536px)"; }; type DefaultBreakpointKey = keyof typeof defaultBreakpoints; /** * Custom hook to determine the currently active responsive breakpoint based on window width. * * @template K Type of the breakpoint keys (defaults to keys of defaultBreakpoints). * @param {Record<K, string>} [customBreakpoints] - Optional custom breakpoints object. Keys are breakpoint names, values are media query strings. * @returns {K | null} The key of the largest currently active breakpoint, or null if none match. */ export declare const useBreakpoint: <K extends string = DefaultBreakpointKey>(customBreakpoints?: Record<K, string>) => K | null; export {};