@clds/text-field
v0.40.0
Published
---
Downloads
31
Readme
@clds/text-field
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