UNPKG

@awsui/components-react

Version:

On July 19th, 2022, we launched [Cloudscape Design System](https://cloudscape.design). Cloudscape is an evolution of AWS-UI. It consists of user interface guidelines, front-end components, design resources, and development tools for building intuitive, en

11 lines 511 B
import { useContainerQuery } from '@awsui/component-toolkit'; export default function useContainerWidth(defaultValue = 0, threshold = 1) { const [width, ref] = useContainerQuery((rect, prev) => { if (prev === null) { return rect.contentBoxWidth; } return Math.abs(prev - rect.contentBoxWidth) >= threshold ? rect.contentBoxWidth : prev; }); return [width !== null && width !== void 0 ? width : defaultValue, ref]; } //# sourceMappingURL=use-container-width.js.map