Socket
Socket
Sign inDemoInstall

@volvo-cars/react-layout-utils

Package Overview
Dependencies
9
Maintainers
8
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @volvo-cars/react-layout-utils

Utility hooks that assist with layout concerns


Version published
Weekly downloads
1.1K
decreased by-39.69%
Maintainers
8
Install size
1.50 MB
Created
Weekly downloads
 

Readme

Source

React Layout Utils

Questions? Ask in Slack #vcc-ui

@volvo-cars/react-layout-utils

This package exposes useful utility hooks that can be use to help you with layout concerns.

Installation

💡 This package includes Typescript definitions


useElementDimensions

Useful for obtaining static render-time dimensions of a given DOM element. Returns a ref and Dimensions object.

NameDescriptionTypeDefault Value
disabledIf true, hook does not refresh dimensionsbooleanfalse
throttleA debounce interval to limit the frequency of dimension updatesnumber0

useResizeObserver

Useful for obtaining dynamic dimensions of a DOM element, where you need to act upon dimension changes in real time. Returns ref, width, and height.

NameDescriptionTypeDefault Value
refA ref to observeundefined | RefObject | HTMLElementundefined
boxThe box model to use for observation.undefined | "border-box" | "content-box" | "device-pixel-content-box"content-box
onResizeA callback receiving the element size. If given, then the hook will not return the size, and instead will call this callback.undefined | ({ width?: number, height?: number }) => voidundefined
roundA function to use for rounding values instead of the default.numberMath.round()

Examples

Demonstration implementations of the hooks can be found in the Storybook.

FAQs

Last updated on 10 May 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc