0.38.0 • Published 4 months ago

@clds/number-field v0.38.0

Weekly downloads
-
License
-
Repository
github
Last release
4 months ago

@clds/number-field


npm version

Documentation of the number field component.

Installation

Install the package using Yarn:

yarn add @cld/number-field

Props

Most props are identical to @clds/text-field

Components

NumberField

Controlled/Uncontrolled number field component

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

Usage

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.

License

See LICENSE

0.38.0

4 months ago

0.37.0

5 months ago

0.33.10

9 months ago

0.33.7

9 months ago

0.36.3

6 months ago

0.33.6

9 months ago

0.36.2

6 months ago

0.35.3

8 months ago

0.33.5

10 months ago

0.36.1

6 months ago

0.35.2

8 months ago

0.36.0

7 months ago

0.35.1

8 months ago

0.33.3

10 months ago

0.32.4

10 months ago

0.35.0

8 months ago

0.33.2

10 months ago

0.34.0

9 months ago

0.33.1

10 months ago

0.33.0

10 months ago

0.33.9

9 months ago

0.33.8

9 months ago

0.32.3

11 months ago

0.32.2

11 months ago

0.32.1

11 months ago

0.32.0

12 months ago

0.31.1

12 months ago

0.31.0

12 months ago

0.30.1

12 months ago

0.30.0

12 months ago

0.29.0

12 months ago

0.28.1

12 months ago

0.28.0

12 months ago

0.27.0

12 months ago

0.26.1

12 months ago

0.26.0

12 months ago

0.25.0

1 year ago