0.40.0 • Published 1 year ago

@clds/number-field v0.40.0

Weekly downloads
-
License
-
Repository
github
Last release
1 year 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.40.0

1 year ago

0.39.0

1 year ago

0.39.2

1 year ago

0.38.0

2 years ago

0.37.0

2 years ago

0.33.10

2 years ago

0.33.7

2 years ago

0.36.3

2 years ago

0.33.6

2 years ago

0.36.2

2 years ago

0.35.3

2 years ago

0.33.5

2 years ago

0.36.1

2 years ago

0.35.2

2 years ago

0.36.0

2 years ago

0.35.1

2 years ago

0.33.3

2 years ago

0.32.4

2 years ago

0.35.0

2 years ago

0.33.2

2 years ago

0.34.0

2 years ago

0.33.1

2 years ago

0.33.0

2 years ago

0.33.9

2 years ago

0.33.8

2 years ago

0.32.3

2 years ago

0.32.2

2 years ago

0.32.1

2 years ago

0.32.0

2 years ago

0.31.1

2 years ago

0.31.0

2 years ago

0.30.1

2 years ago

0.30.0

2 years ago

0.29.0

2 years ago

0.28.1

2 years ago

0.28.0

2 years ago

0.27.0

2 years ago

0.26.1

2 years ago

0.26.0

2 years ago

0.25.0

2 years ago