UNPKG

@yamada-ui/use-breakpoint

Version:

Yamada UI useBreakpoint custom hook

40 lines (37 loc) 2.08 kB
import * as react from 'react'; import { DependencyList } from 'react'; import { Theme, ResponsiveObject, StyledTheme } from '@yamada-ui/core'; /** * `useBreakpoint` is a custom hook that returns the current breakpoint. * This hook monitors changes in the window size and returns the appropriate value. * * @see Docs https://yamada-ui.com/hooks/use-breakpoint */ declare const useBreakpoint: () => Theme["breakpoints"]; /** * `useBreakpointValue` is a custom hook that returns the value of the current breakpoint from the provided object. * This hook monitors changes in the window size and returns the appropriate value. * * @see Docs https://yamada-ui.com/hooks/use-breakpoint-value */ declare const useBreakpointValue: <T>(values: ResponsiveObject<T>) => T; declare const getBreakpointValue: <T>(values?: ResponsiveObject<T>) => (theme: StyledTheme | undefined, breakpoint: Theme["breakpoints"]) => T; /** * `useBreakpointState` is a custom hook that takes a responsive object as an initial state and returns a state corresponding to the current breakpoint. * * @see Docs https://yamada-ui.com/hooks/use-breakpoint-state */ declare const useBreakpointState: <T>(initialState: ResponsiveObject<T>) => [T, react.Dispatch<react.SetStateAction<T>>]; /** * `useBreakpointEffect` is a custom hook that executes a specific callback function when the breakpoint changes. * * @see Docs https://yamada-ui.com/hooks/use-breakpoint-effect */ declare const useBreakpointEffect: (callback: (breakpoint: Theme["breakpoints"]) => void, deps: DependencyList) => void; /** * `useUpdateBreakpointEffect` is a custom hook that skips the side effect on the initial render and executes a specific callback function when the breakpoint changes. * * @see Docs https://yamada-ui.com/hooks/use-update-breakpoint-effect */ declare const useUpdateBreakpointEffect: (callback: (breakpoint: Theme["breakpoints"]) => void, deps: DependencyList) => void; export { getBreakpointValue, useBreakpoint, useBreakpointEffect, useBreakpointState, useBreakpointValue, useUpdateBreakpointEffect };