--- title: useResizeObserver description: "`useResizeObserver` is a custom hook that tracks changes in the size and position of an element." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-resize-observer - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useresizeobserver--basic --- ```tsx const [flg, { toggle }] = useBoolean() const [ref, rect] = useResizeObserver() return ( {JSON.stringify(rect)}
Click me
) ``` ## Usage ```tsx import { useResizeObserver } from "@yamada-ui/react" ``` ```tsx import { useResizeObserver } from "@/components/ui" ``` ```tsx import { useResizeObserver } from "@workspaces/ui" ``` ```tsx const [ref, rect] = useResizeObserver() ```