# @types/react-measure

> TypeScript definitions for react-measure

Latest version **2.0.12** (published 2023-11-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/react-measure
pnpm add @types/react-measure
yarn add @types/react-measure
bun add @types/react-measure
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.12 |
| Published | 2023-11-21 |
| First published | 2016-08-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51440 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/react-measure
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-measure
- npm.io page: https://npm.io/package/@types/react-measure

## Dependencies (1)

- [@types/react](https://npm.io/package/@types/react.md) *

## Recent versions

- 2.0.12 (latest) — 2023-11-21
- 2.0.8 (ts3.7) — 2021-10-21
- 2.0.7 (ts3.6) — 2021-07-07
- 2.0.6 (ts2.8) — 2020-01-22
- 2.0.3 (ts2.6) — 2018-07-30
- 2.0.1 (ts2.3) — 2017-11-30
- 0.4.6 (ts2.1) — 2017-01-23
- 0.4.5 (ts2.0) — 2016-11-21
- 2.0.11 — 2023-11-07
- 2.0.10 — 2023-10-18
- 2.0.9 — 2023-09-27
- 2.0.5 — 2019-02-25
- 2.0.4 — 2018-08-06
- 2.0.2 — 2018-02-12
- 2.0.0 — 2017-08-09
- … 6 more at https://npm.io/package/@types/react-measure/versions

## README

# Installation
> `npm install --save @types/react-measure`

# Summary
This package contains type definitions for react-measure (https://github.com/souporserious/react-measure).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-measure.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-measure/index.d.ts)
````ts
import * as React from "react";

export type MeasurementType = "client" | "offset" | "scroll" | "bounds" | "margin";

interface TopLeft {
    readonly top: number;
    readonly left: number;
}

interface BottomRight {
    readonly bottom: number;
    readonly right: number;
}

interface Dimensions {
    readonly width: number;
    readonly height: number;
}

export type Margin = TopLeft & BottomRight;

export type Rect = TopLeft & Dimensions;

export type BoundingRect = Dimensions & Margin;

export interface ContentRect {
    client?: Rect | undefined;
    offset?: Rect | undefined;
    scroll?: Rect | undefined;
    bounds?: BoundingRect | undefined;
    margin?: Margin | undefined;
    entry?: any;
}

export interface MeasuredComponentProps {
    measureRef(ref: Element | null): void;
    measure(): void;
    contentRect: ContentRect;
}

type MeasuredComponent<T> = React.ComponentType<T & MeasuredComponentProps>;

export interface MeasureProps {
    client?: boolean | undefined;
    offset?: boolean | undefined;
    scroll?: boolean | undefined;
    bounds?: boolean | undefined;
    margin?: boolean | undefined;
    innerRef?: React.Ref<Element> | undefined;
    onResize?(contentRect: ContentRect): void;
    children?: React.FC<MeasuredComponentProps> | undefined;
}

export function withContentRect(
    types: readonly MeasurementType[] | MeasurementType,
): <T extends {}>(fn: MeasuredComponent<T>) => React.ComponentType<T>;

declare class Measure extends React.Component<MeasureProps> {}
export default Measure;

````

### Additional Details
 * Last updated: Mon, 20 Nov 2023 23:36:24 GMT
 * Dependencies: [@types/react](https://npmjs.com/package/@types/react)

# Credits
These definitions were written by [Alexey Svetliakov](https://github.com/asvetliakov), and [Marc Fallows](https://github.com/marcfallows).

---
_Source: https://npm.io/package/@types/react-measure · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
