# @clds/number-field

> ---

Latest version **0.40.0** (published 2024-06-17) · 0 weekly downloads

## Install

```sh
npm install @clds/number-field
pnpm add @clds/number-field
yarn add @clds/number-field
bun add @clds/number-field
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.40.0 |
| Published | 2024-06-17 |
| First published | 2023-05-17 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 40.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Cloudinary |
| Maintainers | cloudinary-internal |

## Links

- npm: https://www.npmjs.com/package/@clds/number-field
- Repository: https://github.com/cloudinary/design-system
- Homepage: https://github.com/cloudinary/design-system/tree/main/libs/components/number-field#readme
- Issues: https://github.com/cloudinary/design-system/issues
- npm.io page: https://npm.io/package/@clds/number-field

## Dependencies (4)

- [@clds/icon](https://npm.io/package/@clds/icon.md) 0.40.0
- [@clds/text-field](https://npm.io/package/@clds/text-field.md) 0.40.0
- [@clds/component-theme](https://npm.io/package/@clds/component-theme.md) 0.40.0
- [@clds/component-enhancer](https://npm.io/package/@clds/component-enhancer.md) 0.40.0

## Recent versions

- 0.40.0 (latest) — 2024-06-17
- 0.39.2 — 2024-06-10
- 0.39.0 — 2024-06-06
- 0.38.0 — 2024-01-08
- 0.37.0 — 2023-12-15
- 0.36.3 — 2023-11-24
- 0.36.2 — 2023-11-20
- 0.36.1 — 2023-11-20
- 0.36.0 — 2023-10-24
- 0.35.3 — 2023-10-04
- 0.35.2 — 2023-09-28
- 0.35.1 — 2023-09-26
- 0.35.0 — 2023-09-20
- 0.34.0 — 2023-09-01
- 0.33.10 — 2023-08-31
- … 25 more at https://npm.io/package/@clds/number-field/versions

## README

## @clds/number-field

---

[![npm version](https://img.shields.io/npm/v/@clds/number-field)](https://www.npmjs.org/package/@clds/number-field)

Documentation of the number field component.

## Installation

Install the package using Yarn:

```sh
yarn add @cld/number-field
```

## Props

Most props are identical to [@clds/text-field](../text-field)

## Components

### NumberField

Controlled/Uncontrolled number field component

Adds custom up/down buttons to control the value from the UI

## Usage

```javascript
import React, { FC, useRef, useState } from 'react';

import TextField from '@clds/text-field';

export const ControlledUsage = () => {
  const [value, setValue] = useState(0);

  return (
    <NumberField
      placeholder="Enter number here"
      value={value}
      onChange={setValue}
    />
  );
};

export const UncontrolledUsage = () => {
  const inputRef = useRef < HTMLInputElement > null;

  const handleButtonClick = () => alert(inputRef.current?.value);

  return (
    <>
      <NumberField inputRef={inputRef} />

      <br />
      <button onClick={handleButtonClick}>Alert current field value</button>
    </>
  );
};
```

## Versioning

This library follows [Semantic Versioning](http://semver.org/).

## License

See [LICENSE](https://github.com/cloudinary/design-system/blob/main/LICENSE)

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