npm.io
0.40.0 • Published 2 years ago

@clds/text-field

Licence
—
Version
0.40.0
Deps
6
Size
66 kB
Vulns
0
Weekly
0

@clds/text-field


npm version

Documentation of the text field component.

Installation

Install the package using Yarn:

yarn add @clds/text-field

Components

TextField

Controlled text field component - does not handle any other responsibilities beside displaying and controlling the field itself.

Usage

import React, { FC, useRef, useState } from 'react';
import TextField from '@clds/text-field';
const ControlledExample: FC = () => {
  const [fieldValue, setFieldValue] = useState(defaultValue);
  return (
    <TextField
      onChange={setFieldValue}
      placeholder="Enter text here"
      type="text"
      value={fieldValue}
    />
  );
};
const UncontrolledExample: FC = () => {
  const textFieldRef = useRef(null);
  return <TextField defaultValue="Test" inputRef={textFieldRef} type="text" />;
};

Versioning

This library follows Semantic Versioning.

License

See LICENSE